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

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 Panel Designed for "Best Graphic Panel in MQL5" Contest. This graphic panel allows to automate manual trading. It has many functions, including the visual construction of trading strategies.

The MCM Control Panel provides the solution for multicurrency trading in MetaTrader 5.

The script allows you to place the deals history on the chart using the graphic objects.

The eInTradePanel is a panel for manual trading, it has some useful functions. It needs the minimum space on the chart.

The panel simplifies manual trading and trailing of the opened position.

Control panel for the MQL5 Best Graphic Panel Contest.

This Expert Advisor will simplify the manual trading. It supports the One-Click trading.

Graphic Panel Contest submission.

The script exports historical quotes data from MetaTrader 5 for the import to MetaTrader 4. This solution will allow you to get the full history for MetaTrader 4.

Chart reinitialization with recalculation of all chart indicators.

This indicator is a combination of moving average and ATR indicators.

It has simple code and trading rules. It's doesn't use any martingale MM strategies.

This class provides methods for working with Windows *.ini files.

The OnTick event handler is designed to proceed the ticks for a certain symbol. This is the version of Multicurrency tick event handler.

The indicator shows the trend and allows to see a price range.

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.