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


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

СIsNewBar class allows to determine the moment of a bar change.

The indicator of the market entry signals using fractals.

Normalized oscillator provided by the signal line and colored dots for making deals.

The indicator building Stop Loss levels lines according to BrainTrend1 trading system data with preliminary price timeseries smoothing.

The channel based on ATR (Average True Range) technical indicator deviations from the moving average.

Two rectilinear channels of standard deviations + curvelinear channel of the parabolic regression with interpolation of a price chart future values.

Signal indicator of the popular BrainTrend1 trading system with preliminary price timeseries smoothing.

When applied to financial markets this method is usually used to determine the moments of prices extreme deviation from a "standard" level.

Normalized oscillator displayed as a histogram.

The indicator calculates forecast prices of the daily price range. It shows resistance and support levels of current day using the prices of the previous day.

This indicator shows the "ultimate support/resistance" levels of current trend. Trend changes is shown with color rectangles, trend direction is shown with colored dots.

This typical signal indicator is based on Stochastic oscillator and Fractals technical indicators.

Typical unnormalized oscillator displayed as a color histogram.

The indicator displays the fast adaptive line that allows to evaluate a trend line.

The oscillator consisting of Momentums series.

A small example of the Mandelbrot fractal calculation in OpenCL. The OpenCL accelerates calculations of fractal approximately up to 100 times in comparison with the CPU calculations.


In this version of Chande Momentum Oscillator the smoothed price is used for the calculations.

This trend indicator is based on SpearmanRankCorrelation indicator values and analysis of its signal lines.

Most visually convenient trend power indicator based on Standard Deviation.

Trend indicator of the popular BrainTrend1 trading system with preliminary price timeseries smoothing.

XR-Squared indicator uses linear regression to determine the presence or absence of a market trend.

The Double Smoothed Stochastics indicator was proposed by William Blau and Walter Bressert. The calculation of DSS values is similar to Stochastic indicator, the difference is the use of double exponentially smoothing.

This indicator is based on Fatl indicator values and analysis of its signal lines.

WKBIBS is a next generation oscillator with combined WKB and IBS indicators functions.

This indicator is based on the first version of Sidus trading method. It shows market entry points.

Visual trend indicator that shows the direction and power of the current price movement.

The Ultimate Oscillator by Larry Williams is calculated as weighted value of three Stochastic, indicators, calculated for fast, middle and short periods.


Internal Bar Strength Indicator measures the "inner strength" of each bar by subtracting the close price from the low and dividing the resulting number by the difference between high and low bars.

Keltner Channel displayed as colored background.

FisherTransform_HTF_Signal shows a trend direction as a graphical object with colored trend indication and gives alerts or audio signals in case of a trend change.


The HighestLowestRange (HLR) determines the relative price position in range of the several X bars ago. If price located at range bottom (new low), the indicator is equal to 0, if price position at the top of the range (new high), the indicator is equal to 1 (or 100%).


The MPC indicator plots a simple channel using extermums of the specified period. It can be used for additional visual control of trading system (channel breakout), based on HighestLowestRange (HLR) indicator.

The script calculates Stop Out price (at this price position will be closed by broker) of the opened position and the price, at which Free Margin became negative (LockOut price).

Bollinger Bands displayed as colored background.

This indicator is based on CCI (Commodity Channel Index) and the analysis of a trend direction of its multiple signal lines.

Unnormalized symmetrical oscillator based on the linear regression algorithm with the simplest trend power indicator.

This indicator is based on Momentum and its multiple signal lines analysis.

Envelope construído pelas médias móveis e calculado da mesma maneira que os de Ichimoku Kinko Hyo.

LinearRegSlope_V1_HTF_Signal shows a trend direction as a graphic object with colored trend indication and sends alerts or audio signals in case the trend changes.

This indicator is based on the integral value of the trend from the fans of similar moving averages with an arithmetic progression of the smoothing period.