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


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 Expert Advisor places a grid of pending Buy Stop and Sell Stop orders.

The Highest Lowest indicator searches for bars having High above the High of bars on the left and on the right, as well as bars having Low below the Low of bars on the left and on the right. Uses the DRAW_ARROW style.

A trend oscillator.


Ulcer Index (UI) - the volatility decrease index.

John Carter TTM Squeeze - an indicator of trend zones.

A Trend Oscillator.


Trend indicator Recursive Trendline (RTL).


Price Volume Trend (PVT) is an indicator of price trend and volume, similar to the standard On Balance Volume (OBV) indicator.

The indicator shows the open price of a period.

An oscillator indicator showing a difference between MA and the price.

A volume indicator with different types of data representation.

A trend indicator: Smoothed High/Low Linear regression band.

A trend indicator: High/Low Linear regression band.

MACD based on the Linear regression MA.

The script draws horizontal lines representing BUY (blue) and SELL (red) orders.

The MESA Adaptive Moving Average (MAMA) and the Following Adaptive Moving Average (FAMA) combination made to be multi timeframe.

Combination of MAMA (MESA Adaptive Moving Average) and FAMA (Following Adaptive Moving Average) made as an oscillator.

This indicator uses the combined values of MAMA (MESA Adaptive Moving Average) and FAMA (Following Adaptive Moving Average) to assess the trend of the market.

Instead of using Simple Moving Average it uses EMA (Exponential Moving Average), and instead of using mean deviation it uses EMA deviation (originally published here EMA Deviation).

This is a Stochastic of CCI. When Stochastic is applied to CCI and the bounds are in the fixed 0 to 100 range, the trend assessment can be done using that fact too.

End Point MA indicator uses the original formula described in the "The End Point Moving Average" article with one deviation: it is made to be "faster" (i.e., to react to market changes in a faster mode than the original version).

EMA Deviation is similar to Standard Deviation, but on a first glance you shall notice that it is "faster" than the Standard Deviation and that makes it useful when the speed of reaction to volatility is expected from any code or trading system.

Synthetic VIX indicates the increase or decrease of volatility and it should be used as that.

This version of BB Stops changes uses EMA deviation for calculation.

This version of Bollinger Bands does not use standard deviation for Upper and Lower Bands, but uses the EMA deviation.

Based on Mel Widner's Rainbow Average (that is similar to Guppy MMA), here is a binary version of Rainbow Oscillator.

The "RocketRSI" indicator by John F. Ehlers. Used to indicate strong probabilities of cyclical reversals.

The Rainbow Oscillator indicator is mainly intended to show the trend of the market. But, using the levels you can use it to assess overbought and oversold conditions too.

Unlike the basic Range Oscillator version, this version uses Bollinger Bands for overbought and oversold conditions assessment.

Range Oscillator is an indicator that shows the relative position of median price in the highest high to lowest low range for desired period.

A library to provide simple storage mechanism for expert advisors and indicators.

WPR (Williams Percent Range) based support/resistance.

A set of digital filters that are always drawn in separate window (due to their nature).

A set of 4 types of digital filters that naturally are placed on main chart.

Based on Mel Widner's Rainbow Average (that is similar to Guppy MMA), this is a sort of generalized version with quite a few extensions.

Handy functions for comparison, rounding, formatting and debugging of doubles (prices, lots and money).

Well known NonLag MA with additions and adjustments.

MACD High/Low made multi timeframe.

Ultra Trend indicator made as multi timeframe.

Indicator based on the NonLag Moving Average.