Watch how to download trading robots for free
Find us on Telegram!
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 - 62


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

William Blau candlestick momentum.

William Blau Candlestick Index.

Indicator of volumes accumulated within a period.

Indicator of volumes accumulated.

Smoothed Stochastic Inverse Fisher Transform.

Kaufman Adaptive Moving Average (KAMA)

The EA waits for the price to pass XXX points within NNN ticks.

The Expert Advisor searches for N identical candlesticks in a row. It buys on bullish candlesticks and sells on bearish ones. The account type is taken into consideration, i.e., whether it is a netting or a hedging one.

Small_Inside_Bar_Strategy - an Expert Advisor based on indicator Small_Inside_Bar.

ChannelEA2 - an Expert Advisor working in a channel, using pending stop orders.

Complete and fast functions similar to Bars and iBarShift from MQL4.

No indicators: Only Open and Close price analysis. Input parameters: Stop Loss, Take Profit, and Trailing.

The EA uses indicators Pivot-2 and Heiken Ashi Smoothed Oscillator.

Historical Volatility Bands that are constructed using average as the middle line, and upper and lower bands using the Parkinson's historical volatility (instead of "regular" Historical Volatility) for bands calculation.

An important use of the Parkinson's number is the assessment of the distribution prices during the day as well as a better understanding of the market dynamics. Comparing the Parkinson's number and periodically sampled volatility helps traders understand the tendency towards mean reversion in the market as well as the distribution of stop-losses.

Trend Envelopes with an option to chose smoothed/filtered price in calculation instead of using "raw" prices.

Indicator based on LSMA (Least Squares Moving Average). It shows the trend of the used average and displays it as a sort of an oscillator.

Quadratic Regression MA is a sort of a linear regression value variation, but faster in response to market changes.

Historical Volatility bands constructed using average as the middle line, and upper and lower bands using the Historical Volatility high/low (instead of "regular" Historical Volatility) for bands calculation.

RSI Candles with an additional option to filter (smooth) the prices prior to using them in RSI calculation (which, effectively makes it an RSI of average).

Historical Volatility Bands constructed using average as the middle line, and upper and lower bands using the Historical Volatility for bands calculation.

This version also does not use Close prices for volatility calculation. Instead it uses the High/Low ratio (the calculation is different from the "regular" Historical Volatility indicator).

Historical Volatility (HV) is a statistical measure of the dispersion of returns for a given security or market index over a given period of time. Generally, this measure is calculated by determining the average deviation from the average price of a financial instrument in the given time period.

BB Stops indicator of smoothed WPR.

BB Stops using RSI for stops calculation.

MACD indicator that is using very well known BB Stops instead of using signal line for signals.

Volatility Quality indicator made "on-chart".

Super Trend indicator extended with additional display types.

Super Trend indicator is probably one of the most known for MetaTrader 4. This version is for MetaTrader 5.

Trend Envelopes indicator made as histogram.

Fibonacci Pivot points indicator that can draw any number of levels for any of the known timeframes usable by MetaTrader 5.

RSI Candles (RSI that calculates RSI of High, Low Open and Close and displays those values as candles) with an addition of Trend Envelopes.

The QQE (Quantitative Qualitative Estimator) made multi timeframe.

Four different CCIs combined into a "candles" display of CCI. For smoothing you can use one of the 4 basic types of averages: SMA, EMA, SMMA or LWMA.

Four different CCIs combined into a "candles" display of CCI.

Combination of 4 RSI values (RSI of High, Low, Open and Close) displayed as candles with additional option to enable prices pre-smoothing prior to be used in calculation, which makes it an RSI-of-MA combination.

This is a RSI of High, Low, Open and Close displayed as color candles in it's own sub-window.

Trend Envelopes variation of RSI indicator.

Trend Envelopes indicator is using only % deviation for calculation and that is the only parameter needed for calculation. It is internally using Close, High and Low price and in this version that can not be changed. Also, due to the nature of the indicator, it can be easily be used as a sort of support/resistance indicator.

This version of ADX instead uses different display in order to make that as easy as it can be. The ADX values are easily comparable to the significant level, the the color of the ADX value and histogram clearly shows the trend. That way it is easier to follow the ADX trend(s) and values.