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

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.

latest|best

The script is developed for placing a BuyLimit order with fixed trigger levels, Stop Loss and Take Profit levels in points from the current price.

The script is developed for placing a BuyStop order with fixed trigger levels, Stop Loss and Take Profit levels in points from the current price.

The script is developed for placing a SellStop order with fixed trigger levels, Stop Loss and Take Profit levels in points from the current price.

The script is developed for placing a SellLimit order with fixed actuation levels, Stop Loss and Take Profit levels in points from the current price.

Multicurrency multitimeframe indicator.

Point and Figure indicator shown in bars and displayed in the separate window.

The trend indicator in the form of a colored cloud using volumes in its calculations. Enhanced version of Bears and Bulls indicator. The idea is to reveal the first market impulse and estimate its duration.

MACD histogram with bars coloring according to Elder Impulse System.

ATRNorm is the normalized version of АTR. Tick volume, standard divergence and other parameters can also be used instead of АТR. The indicator represents logical development of the script. ATRNorm has been created to detect flat areas.

Trend indicator based on two RSI oscillators.

Simple trend indicator in the form of NRTR

The indicator calculates the difference between the period maximum and minimum. The period is specified in the indicator parameters.

The script is developed for selling with fixed Stop Loss and Take Profit values in points from the current price.

The script is developed for buying with fixed Stop Loss and Take Profit values in points from the current price.

The function is used to determine weekends on a server. It will be especially useful to those who use OnTimer() function in their Expert Advisors for events handling.

This library allows an easy interface to MySQL.

Dedicated functions to read and write object properties.

The Momentum Technical Indicator measures the change of price of a financial instrument over a given time span.

QEMA - Quadruple Exponential Moving Average.

PEMA - Pentuple Exponential Moving Average.

The function that calculates the lot size depending on the amount of money in the deposit currency being used.

The function that decrypts the code of the trade operation result for the functions OrderSend() and OrderCheck().

Two-Line MACD. This indicator is available by default in a great deal of trading platforms. But it cannot be found in Metatrader 5.

Class for working with matrices.

Script to create wide screenshots.

Indicator of market instability.

Tools for monitoring spread of currency pairs

This indicator calculates last average price for a symbol and determines the trend direction, so it can be a signal to commit a trade operation.

Opens a virtual hedge position in MetaTrader 5.

This is a simple but very fast ZigZag with no suspended or wrong peaks. The indicator is designed for use in EAs. Peaks retrieval has been time-optimized.

Inspired by Pirat's Expert Advisor submitted to the Automated Trading Championship 2011.

This Expert Advisor illustrates the usage of the IndicatorParameters() function to get the information about the number of input parameters, their type and values.

Corrected Average indicator by A.Uhl (also known as the "Optimal moving average").

A simple script for switching basic timeframes. It allows to change a chart period using hot keys.

Introducing the example of visualization of optimization results in real time (balance curve dynamics and an Expert Advisor statistical parameters).

The Expert Advisor is based on EMA_RSI_VA indicator.

Exponential Moving Average - RSI Volatility-Adjusted by Jose Silva.

Exponential Moving Average - Bollinger Bands ® Volatility Adjusted by Jose Silva.

Advaptive Exponential Moving Average - ATR Volatility Adjusted by Jose Silva.

Adaptive Exponentially Smoothed Moving Average, based on StdDev indicator.

1...838485868788899091929394959697...109