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


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 indicator shows deals history on the chart.

Enhance your charts by adding intelligent markers for important price points and the start/end of year/month/week/day/session Includes a price pointer that changes color whenever price is near an important price point (e.g. historical high/low)

Since Terminal build 344 added display of economic calendar news using special graphical objects (OBJ_EVENT). A script that outputs as a demonstration of the Economic Calendar with current economic data, the date of the last major (Pink) event.

This Expert Advisor uses two Moving Averages and RSI indicator.

This trend indicator is based on moving averages.

This code is a template of an Expert Advisor, written by Valery Mazurenko (notused) for ATC-2010.

QQE - Qualitative Quantitative Estimation MA on RSI, Difference of MA on RSI and MA of MA of ATR of MA of RSI

It uses the values of ADX indicator for trading.

This simple Expert Advisor uses Simple Moving Average and ADX indicators.

The oscillator, based on Ichimoku indicator.

Using Perceptron, Automatic Learning

The indicator shows the position of the current price in a channel.

The indicator plots a price channel using the Hodrick-Prescott Filter.

Smoothed Accelerator

It plots the bar-averaged price charts (median price).

The script calculates the number of lots to trade using the specified percentage of risk funds.

The Improved version of MаrtGreg Expert Advisor.

The indicator allows to perform any arithmetic action with prices of two symbols and plot result on any other chart. It allows to calculate crosses (using multiplication and division), spread (subtract) or just to plot the other symbol's data on the chart.

There is a Price Channel indicator, but I don't like it, because it fills all the space between the upper and lower boundaries. This version of Price Channel looks like in MetaTrader 4.

Moving Average indicator, can be applied to any timeframe (higher or lower than the current chart's timeframe). Includes: SMA, EMA, SMMA, LWMA, AMA, DEMA, TEMA, FRAMA, and VIDYA

Stochastic indicator, can be applied to any timeframe (higher or lower than the current chart's timeframe).

RSI indicator, can be applied to any timeframe (higher or lower than the current chart's timeframe).

All we want is to think about algorithms and methods, not about syntax and values how to place orders. Here you have simple functions to manage positions in MQL5.

MACD indicator with histogram, can be applied any timeframe (higher or lower than the current chart's timeframe).

MACD indicator with MACD line, Signal line and multi-color histogram.

The MACD oscillator with zero lag.

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.