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 - 12

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 opens positions at crossing fast iMA and slow iMA (Moving Average, MA). It has the function of outstaying the losses. It catches the type of the position in OnTradeTransaction.

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

Trading panel based on class CDialog.

A slightly modified EA from the standard delivery: MQL5\Experts\Examples\Moving Average\Moving Average

Working with pending orders Buy Stop and Sell Stop. A channel of two indicators iMA (Moving Average, MA).

Positions are opened pseudorandomly. In case of loss (closing by Stop Loss and negative profit), Martingale is applied.

A trading system based on the signales of indicator ATR_Normalize_Histogram

A trading system based on indicators MACD and SAR. The signal receiving formula is completely optimizable.

Trading on several candlestick patterns. The levels of Take Profit, Stop Loss, and Trailing are separate for BUY and SELL.

The EA works in the quietest hours (upon closing the American session and before opening the Asian session).

A trading system based on the AbsolutelyNoLagLwma indicator signals.

Locking positions - opening Buy and Sell simultaneously.

An automated trading system with a data panel in form of the OBJ_LABEL objects.

Dynamic managing the lot size depending on the balance.

A trading system based on indicator iBands (Bollinger Bands, BB). Placing pending Buy Stop and Sell Stop within a specified time interval (from XX o'clock to YY o'clock).

A trading system based on the signals of indicator AverageChangeCandle.

A trading system based on the XRSIDeMarker_Histogram indicator signals.

A trading system based on the 2XMA_Ichimoku_Oscilator indicator signals.

TST

The Expert Advisor does not use any indicators. It only uses the current price and the OHLC of zero bar.

The trading system is based on a simple neural network.

The EA determines the overbought (OB) and oversold (OS) zones, for which it generates trading signals for selling or buying.

Trading on indicator Heiken Ashi Smoothed Oscillator. Settings for placing Stop Loss, Take Profit, and Trailing the positions.

Working with pending Buy Limit and Sell Limit orders. Trailing the positions is possible.

An Expert Advisor based on indicator SAR.

The EA uses indicator Awesome Oscillator.

A trading system based on detecting the market volatility.

A trading system based on the KWAN_RDP indicator signals.

A trading system based on the KWAN_CCC indicator signals.

Placing Buy Stop and Sell Stop on the 5-minute timeframe.

A trading system based on the KWAN_NRP indicator signals.

The Expert Advisor places pending Buy Stop and Sell Stop orders. If orders execute, the trailing stop is run for the positions.

An assistant Expert Advisor. It moves positions to a breakeven and then enables trailing.

The EA compares the opening prices of the zeroth and the second bar. It moves positions to a breakeven and/or enables trailing.

The EA uses a virtual Take Profit for closing gaining positions. Opening positions with a step. Catch the type of the last position and its price in OnTradeTransaction.

A trading system based on indicator signals Parabolic Stop and Reverse system with the possibility to set a fixed position holding time.

The EA is based on Moving Average.mq5 from standard delivery. Working with OnTradeTransaction to get the price of the last closed position.

The EA based on two iMA (Moving Average, MA) indicators. Selecting the lot calculation mode: Manually or in the risk percentage per trade. Position trailing.

An Expert Advisor based on indicator iMA (Moving Average, MA) and implemented as a class.

An Expert Advisor based on three iMA (Moving Average, MA) indicators.

An EA based on the Doji pattern. Position trailing.

1...5678910111213141516171819...36