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

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

WSO (Widner Support Oscillator) and WRO (Widner Resistance Oscillator).

The Hurst exponent is referred to as the "index of dependence" or "index of long-range dependence". It quantifies the relative tendency of a time series either to regress strongly to the mean or to cluster in a direction.

Fractal Dimension from Mark Jurik is much smoother than the others but the general rule is the same: it is not a directional indicator, but is attempting to determine if there is a trend in the current market price changes or not, and it should be used bearing that in mind.

Mandelbrot describes the Fractal Dimension Index (FDI) as a way to measure "how convoluted and irregular" something is. The FDI can be used as a stock market indicator. The closer prices move in a one-dimensional straight line, the closer the FDI moves to 1.0. The more closely prices resemble a two-dimensional plane, the closer the FDI moves to 2.0.

By it's nature, fractal dimension index indicator is not directional. Instead it is showing if there is a trend or not. If the value of the FDI is less than the target threshold, then there is no trend (the market is ranging). If the value is above that threshold then the market is trending.

BB MACD is a MACD (Moving Average Convergence Divergence) indicator variation with an addition of Bollinger Bands, which helps in detecting trend change points and measuring current trend's strength.

Calculation is based on current week open and previous week range.

Instead of using the "regular" Heiken Ashi for oscillator calculations, this version is using the smoothed Heiken Ashi. That makes the number of false signals fall dramatically, and, when pre-smoothing is applied to Heiken Ashi, the lag is in acceptable bounds.

Instead of using "pure price" this indicator uses Heiken Ashi values to determine the trend as well as the "strength" of the trend.

This is not a directional indicator. This means that even it is stochastic it does not show the direction of the market, but shows the direction-amount-size of volatility. The assumption that seems sound enough and after which this indicator is made is that in the times of extremely low volatility it is a good time to enter the market, since the change in volatility is imminent. Those times are marked by dark gray dots on this indicator. For direction of entry, you should use some other trend showing indicator(s).

EMA Levels multi timeframe version.

Schaff Trend RSX multi timeframe version.

Schaff Trend RSI multi timeframe version.

A library for working with a third-party tick archive.

An Expert Advisor based on two iMAs (Moving Average,MA) and one iRSI (Relative Strength Index, RSI). It tracks virtual profit. Works on two symbols.

Stochastic on the price chart.

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.

1...161718192021222324252627282930...137