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


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

Indicator CMH (Clear Method Histogram) displays a color histogram of the current market trend.


Indicator VC (Volatility Channel by Larry Williams).


Oscillator TTF (Trend Trigger Factor) was developed as a method to identify market trends and reversals.


Oscillator TCF (Trend Continuation Factor) was developed to help identify the trend and direction of the market.

In pscillator Self-Adjusting RSI, we have implemented the methods of automated adjusting the RSI oscillator overbought/oversold levels, described in David Sepiashvili's article The Self-Adjusting RSI.


Indicator RP (Range Position) displays the price position within the range (from Low to High) reached over the previous N periods.


PAC (Periods After Crossing MA) is an oscillator displaying the number of bars elapsed after the last crossing of the price and the moving average.

Indicator showing the difference between the +DI and -DI of indicator ADX.

Buff Dormeier's moving average weighted by volume.


AV (Average Volatility) - a simple average volatility oscillator.


BOP (Balance of Power) is an oscillator that allows you to assess the powers of buyers and sellers on the market and identify the trend reversal within a proper time.

Oscillator Adaptable_CCI. Along with the calculation price and period, this indicator, unlike the standard one, allows you to change parameters, such as calculation range, correction coefficient, and smoothing method.

Indicator Zero Lag Triple Exponential Moving Average.

Indicator Tom_Demark_Moving_Average is the moving average based on Demark's statements regarding trend identification.

A simple indicator based on standard stochastic. Along with the Main and Signal lines of standard stochastic, it also draws a color histogram between these two lines.

Oscillator Slingshot displays in the chart the price momentum histogram and signal line. The probable direction of the fitire price movement is marked in the histogram with different colors.

Channel indicator Rj_SlidingRangeRj with the possibility to round the indicator levels to the required number of digits.


The indicator of probable market reversal based on the true bar value (True Value of Bar).


PDI (Price Difference) is a simple signal indicator of the price difference between the previous and the current bars. It displays as signal marks the candlesticks, on which the previous Applied price is higher than the current one by the pre-defined Price difference.

Indicator Rj_SlidingRange made in the DRAW_FILLING style as a color background, which makes it more illustrative in many situations.

Indicator Rj_RMA with the possibility to change the indicator timeframe in its input parameters.

Indicator Rj_SlidingRange with the possibility to change the indicator timeframe in its input parameters.

Unlike standard On Balance Volume calculated on Close prices only, and indicator MultiVote OBV is calculated on HLC prices, which resulted in its higher sensitivity.


Oscillator MM (Market Mode) allows assessing the market state: In trend state or in cyclic state.


Indicator FIR is a symmetrically weighted filter (Finite Impulse Response Filter).

Indicator EURX displays index EUR.

EMA_With_Trend_Adjustment - a moving average with exponential smoothing and correction by its trend component.

Indicator DI_Cluster represents three indicators ADX with different parameters. Unlike standard ADX, the threshold levels of DI Cluster are not constant, but are determined by the intersections of three indicator lines. You can choose any of the three lines of standard ADX to be displayed: ADX trend strength lines themselves and line +DI or -DI.


Indicator CI (Congestion Identifier). It displays within how many bars before the current one the price was within the channel formed by the Close price of the current bar +/- Delta in points. It also displays the counter value threshold level and the marks, in which the counter is above or below that level.

Indicator RoundPrice-Ext with the timeframe selection option available in its input parameters.

Two independent trading systems using indicators BykovTrend_V2 and ColorX2MA within one EA.

Two independent trading systems using indicators SilverTrend_V2 and ColorJFatl_Digit within one EA.

Cluster indicator based on article

Indicator BykovTrend as candlesticks.

Two independent trading systems using indicators BrainTrend2 and AbsolutelyNoLagLWMA within one EA.

The Expert Advisor places four positions with different Take Profit levels per time. As soon as one Take Profit triggers, the other positions will be moved to breakeven.

Synthetic Japanese candlesticks over the period defined in the indicator settings, calculating on each bar, based on the Bear_Bulls_Power_Candle indicator candlesticks.

Two identical trading systems (for long and short positions) based on the signals of indicator NRTR, which can be differently configured within one EA.

Indicator XPeriodCandle supplemented by Bollinger Bands, based on their candlesticks, and indicating with the bright candlestick color if the candlesticks go beyond the bands.

A candlestick-based chart based on histograms Bear_Bulls_Power calculated on the Open, High, Low, and Close timeseries of the price chart.