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

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 indicator determines the bulls or bears prevail on the market and plots their strength.

The indicator helps to find the reversal bar of the trend.

The updated version of TimeClosingPeriod indicator, it plots the time, remained to the current bar complete. At the last second it plays the sound file, specified in the input parameters.

Color Parabolic 2. The color depends on the acceleration factor.

The CGV class simplifies the work with global variables of MetaTrader 5 client terminal.

The Stochastic of all oscillator-like indicators, included in MetaTrader 5 client terminal.

The Universal Moving Average, it allows to select any type of moving average, included in the MetaTrader 5 client terminal.

A Colorful Fan of Moving Averages.

The Heiken Ashi indicator with smoothing.

An Expert Advisor, based on the "Puria method" Forex Strategy.

The Hodrick-Prescott Filter.

The Moving Average indicator, based on the Quasi-Digital Filter. The MACD indicator as example of its use is presented.

Now it's two-color (or two-mode) trend indicator, the number of calculated bars can be specified.

Bollinger Bands +-3sigma. You can change period and sigma ratio (Proper size of Deviation is 0.5~1.0)

This indicator finds the nearest neighbor by using a weighted correlation coefficient, in which more recent prices have larger weights. The weight decays linearly from newer to older prices within a price pattern.

This indicator uses the Nearest Neighbor clustering technique, also called k-NN, to search for the most similar pattern in history and use its past prices as predictions of the current pattern future prices.

Trend indicator with simple smoothing algorithms.

This indicator fits a trigonometric model to prices and extrapolates it in the future.

This indicator uses an autoregresive model to extrapolate prices

Linear regression slope normalized to SMA.

This is a simple Expert Advisor, that uses a specified custom RKD indicator.

The script purpose is to export historical rates data to format, convenient for analysis in external programs.

Moving Average, calculated using the digital filter.

It searches for tops or bottoms of price movement.

This is HILO Indicator

The indicator shows recalculated ("broken") highs/lows of the standard ZigZag indicator.

The Expert Advisor is based on Heiken Ashi indicator.

The iS7N_SacuL.mq5 indicator is based on the original indicator 'Lucas1.mq4', written in MQL4.

The Rabbit indicator plots the true support/resistance levels for any currency pair.

The purpose of this grid is to replace the standard grid with more convenient, it allows to determine many important points on the chart, the properties of the price movement and checkinh the quotes quality (for the presence of holes).

The function allows checking whether a new bar has appeared on the specified timeframe.

The indicator Measures the distance between the Bollinger Bands ® and providing it as a singular indicator, using the MetaTrader 5 techniques to simplify Bollinger calculations.

The script gets contents from the Windows Clipboard.

Something for those who wants to try out new Strategy Tester and don't have any EA.

The indicator plots Pivot levels for all available history. There are 5 variants of Pivot levels is supported: Classic, Fibonacci, Demark, Camarilla, Woodies. There are 3 calculation periods: daily, weekly, monthly. For the daily pivot levels it's possible to specify the GMT time shift.

The indicator plots Murrey Math Lines for all available history, it doesn't uses any objects.

The ZeroLag MACD indicator shows the histogram with color of the previous bar.

A simple XML-parser, based on the msxml library.

The indicator plots the Bollinger Bands ®, filled with different colors depending on the trend direction.

The indicator plots the candles with different colors depending on the trend direction and price movement.