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

MQL5 Source Codes of Expert Advisors for MetaTrader 5 - 14

icon

Expert Advisors analyze price charts and trade automatically following underlying rules. Here you can find MQL5 source codes solving a variety of problems. You are able to select both simple Expert Advisors based on moving average crossing and complex ones involving complicated signal generation algorithms and protection against trading mistakes.

You can download and launch offered Expert Advisors in MetaTrader 5. It is recommended that you test and optimize trading robots in the Strategy Tester before using them. The library of Expert Advisors is also available directly from MetaTrader 5 platform and MetaEditor development environment.

Submit your code

The EA trades using the signals of iADX (Average Directional Movement Index, ADX) and iSAR (Parabolic SAR) indicators. The profit/loss of the last closed position is taken into account. Positions are moved to breakeven.

A trading system based on three indicators: two iMAs (Moving Average) and iMACD (Moving Average Convergence/Divergence, MACD).

A trading system based on two indicators: iSAR (Parabolic SAR) and iRSI (Relative Strength Index, RSI). Lot calculation based on the risk value as a percentage of free margin.

The Expert Advisor uses Buy Stop and Sell Stop orders to trade news and large price movements.

Opening positions randomly after a certain time interval.

This non-trading Expert Advisor is designed for the simple trailing of take profit orders of open positions.

A Simple Expert Advisor The EA opens a position of the specified type at the time specified in the EA parameters. The position is closed at the time specified in the appropriate parameter.

Implementation of multiple trailing types. Pending Buy Stop and Sell Stop orders. Limitation of the maximum total lot and the total number of positions. Several types of position volume calculation.

An Expert Advisor, which trades in a channel based on the Percentage_Crossover_Channel indicator.

An Expert Advisor based on the Diff_TF_MA indicator.

An Expert Advisor based on the "Fractals at Close prices" indicator.

The Expert Advisor is based on the channel indicator Price_Extreme_Indicator.

It is a further development of the first VR---ZVER version. The new version features trailing stop, a separate flag for allowing/prohibiting BUY positions, a separate flag for allowing/prohibiting SELL positions.

An assistant EA for manual trading. Sets Stop loss, Take profit, moves positions to breakeven and applies trailing.

A trading system based on the ZigZag indicator.

A trading system based on ColorJJRSX indicator signals with the possibility to set a fixed position holding time.

Buy or Sell signals are generated when the price is above iMA (Miving Average, MA) with a very large period. As the number of open positions increases, the distance between trades (during which entry signals are skipped) also increases. The EA trades in the specified time interval.

A trading system based on ColorJFatl_Digit indicator signals with the possibility to set a fixed position holding time.

Two identical trading systems based on the change in the color of the XDidi_Index_Cloud indicator cloud for long and short trades, which can be configured in different ways in one Expert Advisor.

The Expert Advisor allows checking the potential profitability of the ZigZagLW Addition indicator.

An Expert Advisor based on the "Arrows&Curves" indicator.

Martingale based Expert Advisor specially designed for small deposits.

The Expert Advisor uses three iMAs (Moving Average, MA), one iOsMA (Moving Average of Oscillator and one iRVI (Relative Vigor Index, RVI). Trailing stop is based on the High/Low of earlier bars.

Two identical trading systems based on the change in the color of XFatlXSatlCloud for long and short trades, which can be configured in different ways in one Expert Advisor.

A trading system based on the 'EMAAngle' and 'Laguerre RSI with Laguerre filter' indicators.

A trading robot for performing arbitrage between EURGBP and its synthetic quotes (triangular arbitrage).

Usually most brokers do not provide M1 data over 3 months in MetaTrader 4, but they provide M1 data over 3 years in MT5. So we can use this tool to obtain the M1 data in MetaTrader 5 tester and save the data into .hst file for MetaTrader 4 backtesting.

This is an MQL5 version of the Expert Advisor described in the article "How to reduce trader's risks" (https://www.mql5.com/en/articles/4233).

Trading signals are generated based on a comparison of two trend indicators: iMA (Moving Average, MA) and iSAR (Parabolic SAR). The EA works on the zero bar, only one position can be open. Trailing stop is used.

The Expert Advisor trades using the "Japanese Doji Candlestick" pattern.

A further development of code "Dealers Trade v 7.74 MACD" (https://www.mql5.com/en/code/19535). "Zero-lag MACD" (https://www.mql5.com/en/code/170) is used. When the number of positions increases, the following is also increased: step between positions, lot size, take profit (martingale).

The Expert Advisor is based on Puria method with a few changes. It uses two iMA (Moving Average, MA) indicators and one iMACD (Moving Average Convergence/Divergence, MACD).

The Expert Advisor trades based on the signals of iMA (Moving Average, MA) and iMACD (Moving Average Convergence/Divergence, MACD). The minimum distance between the price and the MA indicator is taken into account.

An Expert Advisor based on the iIchimoku (Ichimoku Kinko Hyo) indicator. Fixed lot.

The Expert Advisor uses the signals of "crossover of two iMAs (Moving Average, MA)". The EA uses Trailing Stop and Take Profit.

An example of creating synthetic instruments for calculating the strength of RTS, USD, RUB based on futures contracts of the FORTS market.

MetaTrader 5 allows creating synthetic instruments. The price of such instruments can depend on the current values of a number of financial instruments. In trading, such symbols allow spotting the beginning and end of global market movements at an early stage. In this example we create synthetic instruments to analyze the strength of Forex currencies EUR, USD, GBP, JPY and CHF.

x1

Simultaneous opening of opposing positions. Lot management

The EA uses three iMAs (Moving Average, MA), one iStochastic (Stochastic Oscillator) and one iRSI (RSI, Relative Strength Index). Positions are opened by market, as well as Buy Stop and Sell Stop pending orders are placed.

Information about profit, points, percent, spread and time remaining until the close the bar on the current currency pair and timeframe in a compact and convenient form.

1...789101112131415161718192021...36