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

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 Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones.

The Exp_XROC2_VG_X2 trend-following trading system is based on the signals of two XROC2_VG indicators.

The Exp_XROC2_VG_Digit_Tm Expert Advisor trades based on signals generated by the XROC2_VG oscillator.

The EveningStar Expert Advisor trades the "Evening Star" pattern. Lot is calculated based on the risk value as a percentage of free margin.

The EA trades based on the "Bullish and Bearish Engulfing" pattern.

The trading system is based on volatility compression

The trading system is based on the NRTR_ATR_STOP indicator signals.

The EA buys if the open price of the last position is higher than the current price.

Crossover of two iMAs (Moving Averages), one more iMA (Moving Average) is used as the filter. Lot: manual or risk percent of balance. Stop, Market or Limit orders. The EA also sets Stop Loss, Take Profit, Trailing Stop.

The Exp_ColorXMUV_Tm Expert Advisor is based on the ColorXMUV MA signals and provides the possibility to set a fixed trading time interval.

The Exp_ColorJFatl_Digit_Tm Expert Advisor is based on the ColorJFatl_Digit indicator signals and provides the possibility to set a strict trading time interval.

The trading system is based on the PercentageCrossoverChannel_System indicator signals.

The EA trades in the specified time interval. It takes into account High and Low within a certain number of bars. The EA includes protection against the "not enough money" error.

The EA trades based on the Fractals indicator. Lot calculation: percentage of free margin.

The Exp_PercentageCrossover Expert Advisor is based on the change of the PercentageCrossover color, and provides the possibility to set a strict trading time interval.

The Exp_TotalPowerIndicatorX Expert Advisor is based on the signals generated by the TotalPowerIndicatorX oscillator. It also provides the possibility to set a strict trading time interval

Signals are generated by the iBands, Bollinger Bands indicator. When a signal is received, opposite positions are closed.

The EA waits for a TP or SL to trigger, and then opens a position in the opposite direction. It checks if there is enough money before sending a trade request. OnTradeTransaction.

All information about the current symbol (information from the CSymbolInfo class object is used) represented as a dialog panel.

A trading strategy based on RSI and Bollinger Bands.

An Expert Advisor for 4 currency pairs, including EURUSD, GBPUSD, USDCHF and USDJPY. It is based on four-hour moving averages.

Analyzes bars whose opening time (hour and minute) is equal to the current bar opening time.

This is a trend trading system based on the signals of two Kolier_SuperTrend indicators.

Shows an appropriate value for the last three bars on each timeframe: "1" if the bar is bullish, and "0" if the bar is bearish.

The Exp_XFatlXSatlCloud trading system is based on change of the trend direction displayed by the XFatlXSatlCloud indicator

The Expert Advisor moves trailing stops of all positions on the current symbol.

Plays a sound when position is closed.

Trading based on preset candlestick combinations (patterns) Candlesticks are marked as "1" (bullish) and "0" (bearish). TakeProfit, StopLoss

The Expert Advisor calculates the maximum lot size that can be used to open a position using the entire free margin available on the deposit.

The Exp_Stochastic_Chaikins_Volatility Expert Advisor based on the Stochastic_Chaikins_Volatility indicator color change.

A semi-automated Expert Advisor which signals of breakouts of specified horizontal levels.

The EA searches for N identical candlesticks in a row. If the found candlesticks are bullish, it buys. I they are bearish, the EA sells.

The Expert Advisor trades inside a channel, reversing positions at the channel borders.

Trades based on the previous candlestick.

A list of all positions. An example of working with CPositionInfo.

The Expert Advisor is based on the indicator with the same name. Lot is calculated based on the risk value as a percentage of free margin.

The Expert Advisor closes all positions opened on the account, if the current server time has exceeded the time limit specified in the input variables.

The Expert Advisor closes all the current symbol positions opened on the account, if the current server time has exceeded the time limit specified in the input variables.

Hedge The Hedge Trader EA.

We look for N identical candles in a row. If the found candles bull - we buy, if bear - we sell.

1...101112131415161718192021222324...36