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


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.

Submit your code

The KWAN_NRP indicator with the possibility to change the indicator timeframe in input parameters.

The XRSIDeMarker_Histogram indicator with the possibility to change the indicator timeframe in input parameters.

The averaged non-trivial linear combination of iRSI and iDeMarker implemented as a color histogram.

A simple oscillator, which is based on the values of the iStochastic, iRSI and iMomentum indicators and is implemented as a two-colored histogram.

The iSAR indicator with the possibility to change the indicator timeframe in input parameters, implemented in color.

The Expert Advisor is based on a dynamic moving average.

The Expert Advisor opens positions inside two time intervals. Trades are closed at the specified time. Trailing Stop.

The Expert Advisor is based on 30 popular candlestick patterns.

MACD+SAR - Trend Analyzer Tool.


The Pivot Money Flow indicator displays the direction and the reversal of money flows.

Dynamic overbought/oversold levels.

An assistant indicator. It shows time for holding a position open.

The indicator shows days of the week on the price chart.

An indicator of custom patterns.

The indicator displays on the chart the previous trading day's channel.

ATR Ratio shows a ratio of two ATRs.

A simple ZigZag with an adjustable step.

Dynamic Moving Average.

An indicator of dynamic support/resistance levels.

The indicator of divergences of High/Low indices.

A module of trading signals based on the Moving Average indicator signal module.

The New High New Low Index indicator.

An indicator of multiple fractals.

The indicator searches for divergences and displays them on the chart of the custom CCI indicator.

Bollinger Bands in the form of an oscillator.

The Expert Advisor uses three iMA (Moving Average, MA) indicators and one iMACD (Moving Average Convergence/Divergence, MACD)

An indicator based on Elder's "Safe Zone".

The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The account type is taken into account, i.e. whether it is netting or hedging.

The Expert Advisor works based on the iChaikin (Chaikin Oscillator) and iMA (Moving Average, MA) indicators.

An Expert Advisor trading MACD signals. For those who prefer trading CFDs and futures symbols.

An MQL5 implementation of the adaptive UmnickTrade Expert Advisor.

As a logical step to filter out more the possible false signals, this variation of Schaff TCD RSI is using RSX (which is a smoother RSI than the "regular" RSI) to produce a smoother result.

Schaff Trend Convergence Divergence indicator has the benefit of putting the Schaff Trend CD on a scale of zero to 100, making it easier to identify potential overbought and oversold levels in a currency trend and is using RSI for a final calculation.

Schaff Trend RSX is "a smoother RSI" without a lag, in this version RSX is calculated instead of RSI. That makes the slope much smoother and produces significantly less color (slope) changes.

Schaff Trend RSI is an RSI of the MACD.

In addition to the usual parameters that are controlling the way Kaufman AMA is calculated, this version has adjustable smoothing and filter that can eliminate insignificant AMA changes.

This indicator shows Bulls and Bears power in the same indicator subwindow.

Kaufman AMA MACD is the MACD built exclusively using Kaufman AMA (even signal line is using that). That way this is a completely adaptive MACD (bearing in mind that Kaufman AMA is adaptive Moving Average).

The Price Channel Stop indicator shows the current estimated trend based on channel period and desired risk. It also shows two levels of values that can be used as a stop loss for orders opened based on this indicator (using the trend color change can be used as a signal for a new order opening as well as closing already opened orders).

In the Smoother Momentum Stops indicator the stops are calculated using the smoother momentum and the direction of the stops is determined based on the smoother momentum.