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

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.

To post a new code, please log in or register
latest|best

Two identical trading systems based on the change in the color of the XDidi_Index_Cloud indicator cloud for long and short trades, which can be configured in different ways in one Expert Advisor.

The Expert Advisor allows checking the potential profitability of the ZigZagLW Addition indicator.

An Expert Advisor based on the "Arrows&Curves" indicator.

Two AdaptiveRVICloud indicators from different timeframes on one chart.

Two "Didi Needles" indicators from different timeframes on one chart.

Martingale based Expert Advisor specially designed for small deposits.

The Expert Advisor uses three iMAs (Moving Average, MA), one iOsMA (Moving Average of Oscillator and one iRVI (Relative Vigor Index, RVI). Trailing stop is based on the High/Low of earlier bars.

The smoothed S-RoC indicator of the relative price increment by Fred Shutsman.

The indicator calculates and displays a linear relationship between two or more financial symbols.

Relative Momentum Index implemented as a color histogram with an indication of overbought and oversold zones.

Two identical trading systems based on the change in the color of XFatlXSatlCloud for long and short trades, which can be configured in different ways in one Expert Advisor.

A semaphore signal indicator using the XRSX oscillator, which is similar to BykovTrend with an NRTR line based on the values of the ATR indicator.

A semaphore signal indicator using the XCCX oscillator, which is similar to BykovTrend with an NRTR line based on the values of the ATR indicator.

A semaphore signal indicator, which is similar to BykovTrend with an NRTR line based on the values of the ATR indicator.

The indicator shows a text block with the values ​​of the user defined RVI oscillator period for each timeframe.

The BykovTrend semaphore signal indicator with an NRTR line based on the ATR indicator values.

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

Two Boa_ZigZag indicators with different periods, which appear as arrows on one chart.

A module of trading signals based on the signal module of the iCCI (Commodity Channel Index, CCI) indicator.

The indicator displays trade opening signals based on the author's 'Reversal' trading system.

A trading system based on the 'EMAAngle' and 'Laguerre RSI with Laguerre filter' indicators.

A trading robot for performing arbitrage between EURGBP and its synthetic quotes (triangular arbitrage).

This version extends the Instantaneous Trend Line indicator with a sort of bands to make it easier to spot trend change and to filter out some false signals that can be produced if only the slope of the ITL indicator is takes for a signal.

Instantaneous Trend Line is one of the series of indicators created by John Ehlres.

This version of DeMarker indicator uses the "help" of smoothed Stochastic to emphasize the states of DeMarker and to help in easier trend assessment.

Balance of Power, introduced by Igor Livshin, attempts to measure the strength of buyers vs. sellers by assessing the ability of each to push price to an extreme level. Livshin published this indicator in the August 2001 issue of Stocks and Commodities Magazine. This version of indicator calculates the BOP exactly as it is described in the article where it was published.

T3 is very similar to EMA in calculating way and it makes it suitable for this way of calculation. As an extension of EMA levels it might prove to be useful but by all means do some experimenting in order to get the best results for specific symbol/timeframe combination.

A different way of looking at the fractals: instead of showing fractals the usual way, this indicator shows fractals as an oscillator and can show the "rhythm" of the changes in the market.

Balance of Market Power combined with DSL (Discontinued Signal Line) it can be used both for trending and scalping mode.

Chaos zone indicator that is a combination of two Bill Williams' indicators: Accelerator Oscillator and Awesome Oscillator.

Instead of being in a hurry to follow the price with the stop loss, this indicator is adjusting a proposed stop loss only when it notices a trend change in the opposite direction. That way, it keeps the level intact while trending, and adjusts it when it "sees" that there is a possible trend change) and gives bigger "room" for an order to survive possible whipsaws in trends. Also, since it is estimating a trend, this indicator displays the periods when there is a trend in different color(s) in order to make it easier to decided what to do.

The usual average that is used for stochastic calculation is simple Moving Average (SMA). This (extended) version allows you to use any of the 4 basic types of averages (default is SMA, but you can use EMA, SMMA or LWMA too) - some are "faster" then the default version (like EMA and LWMA versions) and SMMA is a bit "slower", but this way you can fine tune the "speed" to signals ratio.

The DSL (Discontinued Signal Line) version of Stochastic does not use a moving average in a classical way for signals, but is instead calculating the signal lines depending on the value(s) of the stochastic. Thus, we are having two things : a signal line and a sort of levels that can be used for overbought and oversold estimation.

The DSL version of Williams' Percent Range does not use fixed levels for oversold and overbought levels, but is having a sort of dynamic (discontinued signal lines) calculated to identify those levels. That makes it a bit more responsive to market changes and volatile markets.

One more from the creations of John Ehlers - nonlinear Kalman filter.

This is a conversion of Kalman bands originally developed by Igor Durkin. Values are the same as MetaTrader 4 version except that we are using possibilities that MetaTrader 4 does not have to make the indicator easier to use.

Variation of a long known and useful MACD indicator using TEMA (Triple Exponential Moving Average) instead of using EMA (Exponential Moving Average) for MACD calculation, and DSL (Discontinued Signal Lines) and instead of using one signal line uses two.

Variation of a long known and useful MACD indicator using DEMA (Double Exponential Moving Average) instead of using EMA (Exponential Moving Average) for MACD calculation, and DSL (Discontinued Signal Lines) and instead of using one signal line uses two. That way it sort of introduces levels as well as signal lines and, judging from tests, it seems to be better in avoiding false signals and it can be used in (short term) reversals detection.

Stochastic and RVI (Relative Vigor Index) - both indicators measure overbought and oversold area of the market movement. This indicator combines them both in one single indicator - Stochastic of Relative Vigor Index.

Usually most brokers do not provide M1 data over 3 months in MetaTrader 4, but they provide M1 data over 3 years in MT5. So we can use this tool to obtain the M1 data in MetaTrader 5 tester and save the data into .hst file for MetaTrader 4 backtesting.

1...353637383940414243444546474849...150