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 Code Library for MetaTrader 5 - 2

This is the largest free source code library for MetaTrader 5 platform programs. Here you can find ready-made Expert Advisors, technical indicators, scripts and libraries. Use the code library when learning MQL5 language and develop your own automated trading applications based on the provided codes.

You can freely download and test published codes, as well as launch them in MetaTrader 5. The library is also available directly from MetaTrader 5 platform and MetaEditor development environment.


The EA closes all positions if the equity reaches a certain ratio as related to the balance.

Expert Advisor "Previous Candle Breakdown."

Indicator John Ehlers Trend Component

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.

Murrey levels are an efficient tool to forecast the changes in price movement. The main idea of this system is that all markets move in the same manner.

Indicator MultiBrainTrend2_V2_x10 shows information on the current trends, using the colors of indicator BrainTrend2_V2 from ten different timeframes.

Indicator BrainTrend2_V2x10 shows the color of the BrainTrend2_V2 indicator candlesticks from ten different timeframes.

The indicator calculates the inclination angle of the last segment of moving average and shows it in the chart together with the MA line and the line drawn from the last segment of moving average.

Panel indicator with the date on closed positions.

RSI + STARC Bands (Stoller Average Range Channels).

Indicator Volatility_Ratio.

Oscillator TATR (Tick Average True Range).

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.

Indicator AnalysisOnBars with the timeframe selection option available in input parameters.

Informational indicator AnalysisOnBars shows bars without considering the price. Bars are shown in points.

Indicator PDO (Percent Difference Oscillator).

Oscillator Notis% V measures the market volatility, based on the difference between the intraday High and Low.

Trading panel based on class CDialog.

Oscillator MACD Squeeze similar to indicator Trade The Markets Squeeze, but based on MACD.

Intraday Intensity Index.

Channel indicator HWC (Holt-Winters Channel).

Indicator HWMA (Holt-Winter Moving Average) is a three-parameter moving average by the Holt-Winter method.

Indicator of candlestick divergences.

Indicator Difference2 shows the difference between the predefined reference prices (Applied price) now and as of N periods ago.

Oscillator DI (Damping Index) is designed for identifying the damping of the directed market movement.

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).

Indicator BrainTrend2Stop with the timeframe selection option available in input parameters.

Indicator BrainTrend2 that generates alerts and sends e-mails and Push-messages when the indicator changes its color.

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

The inverted chart of the current financial instrument, displaying Ask and Bid price levels.

Indicator AnchoredMomentum_x10 shows the location of indicator AnchoredMomentum from ten different timeframes.

A trading system based on the signales of indicator ATR_Normalize_Histogram

Indicator ATR_Normalize_Histogram with the timeframe selection option available in input parameters, alerting when the overbought/oversold zones are broken through.

A typical oscillator using Average True Range in form of a multicolor 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).

Indicator ASCtrend_NRTR with the timeframe selection option available in input parameters, alerting and sending e-mails and push-messages when the indicator changes its color.

TVI (Trade Volume Index).