Download MetaTrader 5

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

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.

latest|best

Strategy: N bars up and one bar down. Trailing. Lot calculation based on the risk value as a percentage of free margin.

Intraday volatility breakthrough system. The Parabolic SAR indicator is used.

A trade strategy based on the RSI indicator. Checks if there is enough money before opening a position.

A trading system using the SSL indicator.

The EA uses two Moving Averages, one MACD and one CCI. OnTradeTransaction is used to receive position opening time.

Averaging of values (RSI) using MovingAverages.mqh. Two MA indicators.

An Expert Advisor based on the "RPoint" indicator. The chart layout in X-points reversal. A high-quality ZigZag based on HiLo.

The "Nevalyashka" Expert Advisor.

The implementation of the MACD pattern "Trend continuation".

A multi-currency Expert Advisor that opens a market position at the user defined time.

The Expert Advisor trades based on the ADX Wilder and Ichimoku Kinko Hyo indicators. Lot is calculated based on risk percentage of margin.

Trailing, pending orders. Signals of two indicators (Moving Average, MA). Trades only during a certain period of the day.

Trade direction is chosen based on a random number generator. Stop Loss and Take Profit are set based on the random number generator. Lot calculation based on the risk value as a percentage of free margin. The code contains protection against the "not enough money" error.

Intersection of two Moving Averages. Take Profit and Stop Loss levels are virtual.

Trading system based on the signals of the ICHI_OSC indicator

Lot calculation based on the risk value as a percentage of free margin.

Trading system based on the signals of the ThreeCandles indicator

The Exp_IBS_RSI_CCI_v4_X2 trend-following trading system is based on the signals of two IBS_RSI_CCI_v4 indicators.

The Exp_XOSignal_ReOpen trading system based on the signals of the XOSignal indicator with trend following scaling

The Exp_CGOscillator_X2 trend trading system based on the signals from two CGOscillator indicators.

The Exp_ttm-trend_ReOpen trading system based on the signals of the ttm-trend indicator with trend following scaling.

Crossing of the two iMAs. Lot calculation based on the risk value as a percentage of margin.

The Exp_ChandelExitSign_ReOpen trading system based on the signals of the ChandelExitSign indicator with trend following scaling.

An example of determining the moment when a pending order has triggered.

The Expert Advisor opens a deal in the breakout direction. Lot calculation depending on risk percent of margin.

An ExpertAdvisor based on the T3MA-ALARM indicator.

Support\resistance levels, trend direction — bullish\bearish.

The Expert Advisor increases the lot size after each of profitable deal, if it was preceded by losing trades. Martingale.

Short-term trends. Two iMA indicators, one iStochastic.

Example of Buy Limit & Sell Limit pending orders with Bollinger Bands.

OnTradeTransaction

Analysis of OHLC on 0, 1, 2 and 3 bars.

The Expert Advisor solves the problem of position trailing along a given curve by moving its Stop Loss and Take Profit.

The trading system is based on direction changes of the wighted oscillator WeightOscillator

An example of receiving the High and Low prices of bars over the past 24 hours.

Trading system using the IBS_RSI_CCI_v4 indicator

The strategy uses two indicators Moving Average, MA with different periods, Commodity Channel Index, CCI and Williams’ Percent Range, %R.

The trading strategy uses two MA indicators, one ATR and one CCI.

The strategy is based on two indicators: ADX and MA, and the close of the first bar. Also, different TakeProfit, StopLoss and Trailing levels are used for Buy and Sell.

An assessment is made based on the values of five indicators (Gator, WPR, AC, DeMarker and RSI). Uses trapezoidal membership functions. Before sending a trade request, it checks if funds on the account are enough.

12345678...19