Watch how to download trading robots for free
Find us on Facebook!
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 - 15

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 signals of the iMACD (Moving Average Convergence/Divergence, MACD) indicator. Lot is increased when the number of position grows (Martingale)

An Expert Advisor based on indicators "MA Cross 3MACross Alert WarnSig" (https://www.mql5.com/en/code/19519) and "Price Channel" (https://www.mql5.com/en/code/44)

A trading strategy using the Martingale system.

The Expert Advisor uses signals of the iMA (Moving Average, MA) indicator with a delay from the bar opening time.

The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones.

Two identical trading systems based on the crossover of the CMO indicator and the zero line, for long and short trades, which can be configured in different ways in one Expert Advisor.

A trading system based on the signals of the Daniella semaphore signal indicator.

Trading against the trend direction as of N hours ago.

A daily bar breakout strategy.

An Expert Advisor based on "KDJ Indicator"

The Expert Advisor trades based on iMA and iRSI signals. Values of iMA on four bars are compared. Indices of these bars can be optimized.

A trading strategy "three bars down, Stochastic up".

A trading system based on the Martingale technique.

A trading system based on the Vortex Oscillator signals.

The Expert Advisor is based on the signals of indicators iBands (Bollinger Bands, BB) and iRSI (Relative Strength Index, RSI).

Martingale and anti-martingale.

Maximum lot calculated based on free margin.

The Expert Advisor is based on the signals of the Stopreversal indicator and is provided with the possibility to set a strict trading time interval.

The Expert Advisor is based on the iRSI (Relative Strength Index, RSI) indicator signals.

The Expert Advisor is based on the iOsMA (Moving Average of Oscillator, OsMA) indicator signals.

An Expert Advisor for two currency pairs

The Expert Advisor tracks positions of all symbols with all magic numbers. If a position has been open for "Waiting for seconds" and its profit has reached "Take Profit" points, the EA closes the position. If the profit has not reached "Take Profit" points, the EA moves the take profit level.

The Expert Advisor is based on Bill Williams' strategy.

Closing positions: all, only profitable or only losing positions.

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

A trading system based on the NRTR_ATR_STOP indicator signals with the possibility to set a strict trading time interval.

Works with pending Buy Stop and Sell Stop orders. The EA uses the iMA (Moving Average, MA) indicator with a VERY large period equal to 590.

A strategy based on iMA (Moving Average, MA) and iMACD (Moving Average Convergence/Divergence, MACD).

An example of a template for developing automated trading systems.

The expert advisor moves stop loss of position at user-defined breakeven.

Simple Expert Advisor based on the Larry Conners RSI 2 strategy.

The trading system is based on iMACD (Moving Average Convergence/Divergence, MACD) and iStochastic (Stochastic Oscillator)

The Expert Advisor checks the direction in which the price has been moving for the last 10 seconds, and opens a position in accordance with the movement. The EA sets Stop Loss and Take Profit.

Works with pending stop orders (Buy Stop and Sell Stop). Monitors spread %.

The EA lock positions.

A trading system based on the Alligator indicator. If possible, the EA moves positions to breakeven and then enables trailing stop.

The Expert Advisor uses the following indicators: Moving Average Convergence/Divergence, MACD; Moving Average, MA; Average Directional Movement Index, ADX. It closes half of the profitable position.

The Expert Advisor trades in a channel. When a flat channel is found or when the market slows down, the EA places a pending order expecting the channel breakout.

A trading system based on the Vortex indicator signals.

A multi-currency Expert Advisor based on the iStochastic (Stochastic Oscillator) indicator signals.

1...8910111213141516171819202122...36