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


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 MQL5 keywords and aliases for autoreplace are presented.

It's an oscillator, similar to OsMA with Variable Index Dynamic Average.

This library will allow you to tranfser realtime quotes from MetaTrader 5 to external server application.

The indicator is based on the Elder's Impluse system.

This Expert Advisor is based on Bollinger Bands. It uses trend-following strategy and Bollinger Bands indicator.

It uses martingale, the number of doublings is limited.

This is MQL5 version of DinapoliTargets indicator. The ZigZag indicator is added to the chart.

This Expert Advisor allows you to save infomation about the ticks, actual or simulated in Strategy Tester.

The Relative Strength Index, applied to standard deviation of price.

This robot uses a random number generator to simulate simply tossing a coin to decide on the direction of each trade. It provides an example of a minimal expert advisor programmed in an object-oriented style. It also provides a basis for quantifying the value added by alternative methods of entry.

One-click trading.

The Dual Trix indicator with dual magnified Values in the Chart and in the Indicator window.

The Multicurrency Expert Advisor.

An Expert Advisor, based on two MACD, it uses the martingale money management system.

Dual Trix Upgrade 1.

This indicator is based on simple MACD but allows you to choose also timeframe of indicator, different from current. You can choose current timeframe of chart (then indicator shows the same values as common MACD) or any higher timeframe.

The spread_on_chart indicator shows the current values of spread, stop and freeze levels.

The API functions to Free Fuzzy Logic Library.

This is the Heiken Ashi indicator, based on the averaged Open, High, Low and Close prices, averaged using the Adaptive Moving Average.

This Expert Advisor uses the Index Moving Average indicator.

The indicator shows the rate of change of the simple moving average.

An Expert Advisor for trading during the night.

The NRTR (Nick Rypock Trailing Reverse) indicator draws the base line (support and resistance) and a target line.

Dual Trix Indicator : 2 Moving Averages.

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.