Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Access the CodeBase from your MetaTrader 5 terminal
Couldn't find the right code? Order it in the Freelance section
How to Write an Expert Advisor or an Indicator

MQL4 Source Codes of Expert Advisors for MetaTrader 4

icon

Various applications to automate analysis and trading are available in the 'Expert Advisors' section. It features various applications based on different trading algorithms and provides different degrees of automation. You can find simple EAs and complex trading robots that can fully automate analysis and trading processes.

These applications can be downloaded and run in MetaTrader 4. It is recommended to test and optimize Expert Advisors in the Strategy tester. The Expert Advisors from the library can be accessed from the MetaTrader 4 platform and the MetaEditor development environment.

Submit your code

This EA scalps using the Relative Strength Index (RSI) Indicator, Stochastic Oscillator Indicator, and Bollinger Bands Indicator to identify trend or counter-trend opportunities. As a multi-pair EA, it scans multiple currency pairs for signals. This EA comes with a variety of features, including Trailing, Risk Management, Money Management, Restriction Mode, and more. With the right settings, it has the potential to generate significant profits.

This Expert Advisor opens trades based on the crossover of two adjustable moving averages. You can fully customize the periods, type (e.g., EMA, SMA), and direction (long-only, short-only, or both). It includes optional Stop Loss, Take Profit, and Trailing Stop settings.

This Expert Advisor (EA) analyzes market movement by calculating the average pip movement per tick and the average spread over a user-defined number of ticks (MAX_TICKS). It also evaluates the average pip movement and spread over a specified time interval (CHECK_SECONDS). The EA dynamically tracks price changes and spread values, printing the results in the terminal and displaying them on the chart using the Comment() function. This helps traders gauge market volatility and spread fluctuations in real time.

This is a piece of code to add to an existing Expert advisor to track withdrawals from your account where the EA is running. It helps the user to monitor his or her withdrawals from a particular account.

RRS Tangled EA randomly selects currency symbols, lot sizes, and order types for trading. It does not rely on technical indicators or fundamental analysis. Instead, it uses a Randomness in Nature approach to open trades. With proper settings such as Take Profit, Stop Loss, Trailing, and Risk Management, this EA can generate significant profits.

This EA is a cleaned and minimized version of the RRS Randomness in Nature EA. It opens trades randomly with random currency pairs, random lot sizes, and random order types. This EA does not rely on any technical skillset such as indicators, price action, news calendar events, or candlestick patterns. It offers multiple trading strategies, risk management plans, and other customizable settings.

This EA is truly random in nature. It randomly selects currency pairs, lot sizes, and order types. This EA does not rely on any technical skillset such as indicators, price action, news calendar events, or candlestick patterns. It offers multiple trading strategies, risk management plans, and other customizable settings. Even though the EA works on randomness, it has still achieved good profits with proper risk management settings.

This is a Non-Directional Bias EA. This EA does not rely on any technical skillset such as indicators, price action, news calendar events, or candlestick patterns. It offers multiple trading strategies, risk management plans, and other customizable settings. This EA takes trades continuously and randomly, depending on the strategy you have chosen.

CloseAllOrdersEA for MetaTrader 4 closes all existing orders upon initialization. It works by: OnInit: Calls CloseAllOrders to shut down all market and pending orders. OnDeinit: Only logs deinitialization. OnTick: No action needed as orders are closed on start. CloseAllOrders: Loops from last to first order, retries up to 3 times to close/delete orders with error handling, uses current price for market orders, and deletes pending orders. Error Handling: Logs detailed errors for unsuccessful operations.

A real-time monitoring tool for MetaTrader 4 that displays key financial data, allows quick symbol switching, and customizable symbol lists. Save and reload symbols, reset lists, and customize text and panel colors for a personalized trading experience.

Symbol Swap Panel: Effortlessly switch the active symbol on your chart while simultaneously adding the new symbol to Market Watch. This tool ensures seamless integration and access to real-time market data, optimizing your trading workflow.

This is a pretty simple startegy that follows trend. Recommended time frams is D1. when close price brakes up the EMA build based on high prices given that RSI is above 55 and RSI is above its Moving average - we buy. when close price brakes down the EMA build based on low prices given that RSI is below 45 and RSI is below its moving average - we sell. system closes previose trade if there is opposite signal system uses take profit and stop loss as well as trailing stop

Backtesting Trade Assistant Panel

This expert opens trades based on signals from multiple technical indicators.

The Doji Pattern Detector EA is designed to automatically detect the classic Doji candlestick pattern on any chart. A Doji pattern occurs when the open and close prices of a candle are very close to each other, signaling market indecision. This EA identifies Doji candles where the open and close prices are within a small range and positioned near the midpoint of the candle's high and low.

This code can detect if its a friday of the first week of the month. It is usually to detect days with NFP. Sone trader dont want to trade at that day. Maybe this code can help some one who need it

A professional Grid advisor works according to RSI ( Relative Strength Index ) indicators. And has the function of Reducing the Drawdown on the account by overlapping unprofitable orders. The chart displays information about the profit. It can be a very useful tool, For manual trading.

This EA will scan all the closed trades and then print the nth trade from the end

This EA will scan all the open trades and then print the nth trade from the end

This is a simple code to mimic onTradeTransaction Event handler defined in MQL5

Classic & Virtual Trailing for MT4

Virtual SL TP Pending with SL Trailing for Symbol Chart

This MQL4 EA is designed to close positions for a basket of currency pairs based on certain profit and loss thresholds.

Trailing_StopLoss_for All_orders_and_symbols

Simple continuous trend-following strategy for buying and selling based on predefined conditions

Close_on_PROFIT_or_LOSS_inAccont_Currency

simple trail stop loss code example.

[@Buy_Sell_Close] Manual trading EA for trading newbies, EA can be used in backtesting visual mode, EA can also be used in live trading. You can practice your own trading system in backtesting.

this shortcode will calculate the drawdown of a particular ea, where it is applied to a specified symbol.

When we want to know how many times price will goes up and down 40 pips before breaking this channel, we will need Bounce Number tool.

a Simple Visual Strategy Tester / Manual Trade Training using Martingale.

Most EAs tend to close orders in take profit based on the distance in pips from the purchase price. However, this MQL4 code is based mainly on the current profit.

A Donchian Channel Strategy breakout EA Scalper. Best results at H1.

The Double Bollinger Band Strategy makes use of two Bollinger Bands in order to filter entries and exits in the forex market.

This is an mql5 Expert Advisor trading the breakouts and using Martin Gale risk management.

Low risk, max profit, winning strategy EA. Based upon Super Scalper EMAs indicator

This time, we're providing a sample that enters based on the Golden Cross and Dead Cross of the moving averages. If you want to see a sample where a long entry is made when the closing price of the candlestick crosses above the moving average, please refer to this article.

a Versatile automated trading tool for the MetaTrader 4 platform. This EA is designed to assist traders in managing their positions effectively by offering features such as setting a breakeven point, trailing stop, stop loss, and take profit levels. It works with various input parameters, allowing you to customize its behavior to fit your trading strategy.

The EA created sell/buy limit orders according to: - Grid number of orders - Trading range (computed automatically by uwing weekly highs and lows) - Current price

This is a grid trading algorithm idea.

1234567891011121314151617181920212223242526272829