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

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
latest | best

Trend Continuation Factor (TCF) indicator identifies the trend and its direction.

Trend Continuation Factor (TCF) indicator with Jurik smoothing identifies the trend and its direction.

The Phase Change Index (PCI) is an indicator designed specifically to detect changes in market phases.

Variation of the well known Bollinger Bands indicator.

T3 Deviation uses intermediate steps of T3 calculation to get the deviation based on T3. As expected the deviation calculated this way is much smoother than the Standard Deviation (as a result of using T3 which on its own is smoother than the simple moving average), and is "faster" in response to market changes.

Zero lag T3 uses the "zero lagging" method to make it even faster and to keep the smoothness.

This version of Hull Moving Average makes the lag even lesser and still keeps the smoothing of the Hull Average thus making it even "faster".

Ron Black's Swing Line indicator with only two states displayed: state up and state down.

Based on the original Dynamic Balance Point, this version is a bit cleaner and simpler to use indicator.


TWR is an indicator of a trend reversal.


The QQE (Quantitative Qualitative Estimator) indicator consists of a smoothed Relative Strength Index (RSI) indicator and two volatility-based trailing levels (fast and slow).

Ron Black's Swing Line indicator made as histogram indicator.

Ron Black's swing line indicator with adjusted display option.

ADXm is a variation of a well known ADX indicator made to be multi timeframe capable.

ADXm is a variation of a well known ADX indicator.

Indicator that calculates dynamic balance point for the desired period.

A variation of linear regression.

Implementation of Alexander Elder's power system indicator, it will show the price trend and trend reversal.

Jurik smoothing is very responsive to price changes, is very smooth and it makes it a very good candidate for this type of trend assessment.

Ultra Trend is one of the well known indicators made for MetaTrader 5 now.

Vortex indicator (based on the article that was published in the January 2010 issue of TASC) with a smoothing option.

Based on the Austin Passamonte's idea, this indicator calculates intra-day pivots.

This version of Williams Percent Range has an addition of Bollinger bands to help identify possible overbought and oversold levels breaks.

Indicator based on the Daryl Guppy's original strategy.

This is the version that David Rooke proposes as a solution to Bollinger Bands issues in a percent representation.

This is the version that David Rooke proposes as a solution to Bollinger Bands issues.

Linear regression line with an addition of standard error channel projection.

This version of WSO (Widner Support Oscillator) and WRO (Widner Resistance Oscillator) shows channel on chart instead of displaying oscillator values in a separate window.

WSO (Widner Support Oscillator) and WRO (Widner Resistance Oscillator).

The Hurst exponent is referred to as the "index of dependence" or "index of long-range dependence". It quantifies the relative tendency of a time series either to regress strongly to the mean or to cluster in a direction.

Fractal Dimension from Mark Jurik is much smoother than the others but the general rule is the same: it is not a directional indicator, but is attempting to determine if there is a trend in the current market price changes or not, and it should be used bearing that in mind.

Mandelbrot describes the Fractal Dimension Index (FDI) as a way to measure "how convoluted and irregular" something is. The FDI can be used as a stock market indicator. The closer prices move in a one-dimensional straight line, the closer the FDI moves to 1.0. The more closely prices resemble a two-dimensional plane, the closer the FDI moves to 2.0.

By it's nature, fractal dimension index indicator is not directional. Instead it is showing if there is a trend or not. If the value of the FDI is less than the target threshold, then there is no trend (the market is ranging). If the value is above that threshold then the market is trending.

BB MACD is a MACD (Moving Average Convergence Divergence) indicator variation with an addition of Bollinger Bands, which helps in detecting trend change points and measuring current trend's strength.

Calculation is based on current week open and previous week range.

Instead of using the "regular" Heiken Ashi for oscillator calculations, this version is using the smoothed Heiken Ashi. That makes the number of false signals fall dramatically, and, when pre-smoothing is applied to Heiken Ashi, the lag is in acceptable bounds.

Instead of using "pure price" this indicator uses Heiken Ashi values to determine the trend as well as the "strength" of the trend.

This is not a directional indicator. This means that even it is stochastic it does not show the direction of the market, but shows the direction-amount-size of volatility. The assumption that seems sound enough and after which this indicator is made is that in the times of extremely low volatility it is a good time to enter the market, since the change in volatility is imminent. Those times are marked by dark gray dots on this indicator. For direction of entry, you should use some other trend showing indicator(s).

EMA Levels multi timeframe version.

Schaff Trend RSX multi timeframe version.