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

Top MQL4 and MQL5 source codes based on user ratings - 60

Submit your code

Closing positions when reaching a profit level

Working by iMA (Moving Average, MA) and OHLC of W1 timeframe

Indicator Mean reversion

The Expert Advisor applies iADX (Average Directional Movement Index, ADX) and iBands (Bollinger Bands, BB) indicators

SpearmanRankCorrelation_Histogram indicator with the timeframe selection option available in input parameters

The Fib_SR indicator with three additional support and resistance zones

Indicator Heiken_Ashi_Smoothed_VolatilityStep without rounding, multiplied by the averaged volumes

Indicator MACD Overlay

Indicator Stochastic Overlay

Indicator Multi timeframe Gann Hi Lo Activator

Indicator Smoothed ADX

I used to suffer from unnecessary losses and/or cutting my profit short since I wasn't fast enough to modify my SL and/or TP. That is why I've wrote these scripts that will allow me to react fast when I must modify my Sl and/or TP especially when I have many open and/or pending trades. I know there are plenty of Metatraders who also suffer from this and that is why I would like to share these scripts with you, hopefully it will be beneficial. Do not forget to send you comments as well as rate these scripts. Happy trading!

Relative Strength Index that completely removes noise, works on all markets!

The code above is a "Hammer" indicator that detects candlestick hammer formations (bullish and bearish) and inverted hammer formations (bullish and bearish) on a MetaTrader 5 chart. This indicator identifies price reversal patterns by calculating the size and ratio of the candlestick wicks based on adjustable parameters: MaxRatioShortWick, MinRatioLongWick, and MinCandleSize. When a pattern is detected, the indicator displays a colored arrow near the candle’s lowest or highest price according to the pattern’s direction. The code also includes functions to create and delete objects automatically when the indicator is initialized or stopped.

MACD Divergence indicator

Daily VWAP (Volume Weighted Average Price) is a simple yet powerful indicator that calculates and displays the Volume Weighted Average Price for each trading day. Ideal for identifying intraday fair value and supporting your daily trading decisions.

This MetaTrader 5 (MT5) custom indicator, boomSpikeBoxMitigationFinal.mq5, detects a specific bullish spike pattern on the chart and marks entry zones using rectangles and horizontal lines. Once the price returns to ("mitigates") the entry level, the entry line is shortened to the mitigation point.

The Price Rate of Change (ROC) reflects this ondulatory movement like an oscillator, measuring the difference in prices in a certain period. ROC grows if prices grow and drops along with them. The more the price change is, the more ROC changes.

This indicator is based on simple MACD but allows you to choose also timeframe of indicator, different from current. You can choose current timeframe of chart (then indicator shows the same values as common MACD) or any higher timeframe.

There is a Price Channel indicator, but I don't like it, because it fills all the space between the upper and lower boundaries. This version of Price Channel looks like in MetaTrader 4.

Trade signals based on "Hammer/Hanging Man" candlestick pattern, confirmed by Commodity Channel Index (CCI) indicator is considered. The code of the Expert Advisor based on this strategy can be generated automatically using the MQL5 Wizard.

The DRAW_COLOR_ARROW drawing style plots the color arrows (symbols from Windings font).

Fast Adaptive Trend Line (FATL) is based on the low frequency digital filter.

The Mass Index is intended for detection of trend reversals based on changes in the bandwidth between the highest and the lowest prices.

Simplified Ichimoku indicator (Ichimoku Kinko Hyo) containing only the cloud.

More informative Average Directional Index (ADX) indicator with the possibility to select the smoothing algorithm out of ten possible variants.

CBullsBearsOnArray class is designed for calculation of Bulls Power and Bears Power values on indicator buffers. The example of use of the class is provided.

This indicator is based on the integral value of the trend from the fans of similar moving averages with an arithmetic progression of the smoothing period.

The indicator displays the price location within a specified range.

The trading system based on the signals taken from the CMO oscillator

Weighted Moving Average with a minimal lag using a damping cosine wave as the line of weight coefficients

The class is designed for calculation of the technical indicator Moving Average Convergence/Divergence (Moving Average Convergence/Divergence, MACD) using the algorithm of the ring buffer.

Variation on the non-trivial linear combination of stochastic oscillators

An Expert Advisor based on two indicators - Renko Line Break and RSI. It trades stop orders.

Another version of the indicator that calculates support/resistance levels.

Three Relative Vigor Index indicators from three different timeframes displayed on the same chart.

The indicator draws rectangle candlesticks of a higher timeframe based on the values of the BrainTrend2 indicator.

The TRIX indicator uses Tilson averaging.

This indicator is a small modification of classical Fractals Indicator. You can choose the number or left/right bars to have a new top or bottom as well a shift parameter.

A library of GUI Controls.

1...535455565758596061626364656667...191