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

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

A signal indicator for opening/closing positions.

A trend signal indicator.

The indicator displays the ratio of two LSMAs.

Linear regression line (LSMA) - a moving average calculated by the linear regression method.

A Moving Average based on Heiken Ashi candlesticks.

Modified BW Zone Trading - a modified indicator of Bill Williams' zone trading.

Detrended Price Oscillator Bar - price chart without a trend.

The Expert Advisor opens no more than one position per day. Positions are opened at the specified time. It searches for the Highest and Lowest price in an interval. Data of two iMA (Moving Average, MA) indicators are used.

A colored histogram of the days of the week. Uses the drawing style DRAW_COLOR_HISTOGRAM.

An arrow indicator, which compares the daily open price with the close price of an hour.

A utility for applying trailing stop based on the "Parabolic SAR" indicator.

The Expert Advisor places pending Buy Stop and Sell Stop orders. Includes checks for the minimum distance of orders in points (SYMBOL_TRADE_STOPS_LEVEL).

Trend detection based on the last three bars.

A histogram of the days of the week.

An Expert Advisor based on two iMAs (Moving Average, MA) and one iSAR (Parabolic SAR). Position trailing.

The Expert Advisor opens positions when the price crosses line objects.

Simultaneous opening of two opposite positions. Trailing Stop.

A module of trading signals based on the Moving Average indicator signal module.

VSI - Volatility Switch Indicator.

The IDayIIndex (Intraday Intensity Index) oscillator indicator.

A stochastic momentum.

A colored histogram drawn using the High/Low prices.

The indicator adds signal marks to a price chart when the CCI indicator crosses its zero line.

An indicator of the market state.

Gap searching indicator.

SZO (Sentiment Zone Oscillator) is an indicator of market sentiment, which has overbought and oversold zones.

CVI (Chartmill Value Indicator) shows the value of price deviation from the Moving Average.

Pending Buy Stop and Sell Stop orders. The EA trades in the specified time period. Determines the highest and lowest prices in the specified range of bars. Position trailing.

An Expert Advisor based on the iIchimoku (Ichimoku Kinko Hyo) indicator. Separate Stop Loss, Take Profit and Trailing Stop for BUY and SELL positions. The EA operation time is configurable. A check is performed on the current bar: only one position can be opened.

An indicator for automatic drawing of trendlines based on fractals of a given timeframe.

The EA trades using pending Buy Stop and Sell Stop orders, applying the iAMA (Adaptive Moving Average, AMA) indicator based on a "round price". Position trailing.

Example of functions MathCeil, MathRound and MathFloor.

The Expert Advisor uses the Fractals indicator signals to place pending orders and trail the Stop Loss level of positions.

The AD (Accumulation Distribution) indicator with three calculation methods.

SSS (Special Slow Stochastic) has an additional smoothed (slow) line based on the Stochastic signal line.

The "Small Inside Bar" indicator. It searches for formations, in which the internal candlestick of the "Internal bar" pattern is not more than half the size of the determinant candlestick.

The indicator calculates and displays on a chart the autocorrelation function, which shows the relationship between the function (signal) and its shifted copy depending on the time shift value.

The indicator allows setting any dimension for each side of a fractal.

MACD with advanced settings. In addition to the standard parameters of the fast and slow EMA periods, signal SMA periods and calculation price, this indicator allows setting the calculation method for each line and use either absolute or relative values for MACD calculation.

The KWAN_NRP indicator with the possibility to change the indicator timeframe in input parameters.

1...456789101112131415161718...125