Browse Indicators
Indicators MT5 Indicators MT4 Indicators ICT Indicators MT5 ICT Indicators MT4 ICT Indicators Add Indicators Download/Add MT5 Indicators Download/Add MT4 Indicators Blog Browse Indicators
Olymptrade – Start with $10. Get up to 100% more.
Product Post

MACD Divergence MT5 Indicator

Last Update Nov 4, 2026 4 min read 2,284 views 0 comments Beginner
Indicator file
MACD Divergence
Free licence

Pairs two swing points 5 to 30 candles apart with the MACD histogram and draws a blue Buy or pink Sell line on both windows when they disagree.

The MACD Divergence MT5 indicator looks for two swing points of the same kind where price and the MACD histogram move in opposite directions. When a lower low meets a higher histogram reading, it joins the two lows with a DeepSkyBlue line and writes Buy under the second one; when a higher high meets a lower reading, the line is DeepPink and the label says Sell.

MACD Divergence Specifications

The MACD Divergence indicator keeps a standard MACD in its own window under the chart and places its divergence drawings on the candles and across the histogram.

ItemDetails
PlatformMetaTrader 5 (MT5); also available for MT4
CategoriesOscillators, Signal & Forecast
Indicator typeDivergence, Reversal
Skill levelBeginner
TimeframesAny; shown here on M15
Trading styleIntraday, Day Trading
MarketsForex (shown on USDJPY and EURUSD)
DisplayMACD histogram and Signal line in a separate window; divergence lines on the candles and on the histogram, with Buy and Sell labels
AlertsNone
Version1.05

With the Common tab open on USDJPY M15, the indicator window underneath already carries two DeepSkyBlue lines, the bullish divergences of 24 and 29 October 2024. Both sit under the zero line, where the grey MACD bars are negative.

MACD Divergence MT5 indicator Common tab on a USDJPY M15 chart
Common tab of MACD Divergence MT5 over the USDJPY M15 chart

What Is the MACD Divergence Indicator?

The MACD Divergence indicator is a divergence finder built on the MACD, the Moving Average Convergence Divergence oscillator. Its window shows the MACD as grey histogram bars, made from a Fast EMA period of 12 and a Slow EMA period of 26 on the Close price, together with a dark red Signal line that smooths those bars over 9 periods. The Data Window lists the two values as MACD and Signal.

On the price side, the tool uses 8 candles to decide what counts as a swing high or low, a pivot, and pairs each new pivot with an earlier one of the same kind. A bullish divergence is a lower low on the candles while the histogram at that low is higher than at the earlier one. A bearish divergence is a higher high while the histogram at that high is lower.

Three inputs set how strict a match must be. The Minimum and Maximum distance between two pivots keep each pair 5 to 30 candles apart, and the line joining the two histogram values may be crossed by no more than 8 grey bars, the default of Number of MACD that break the line. With a ninth bar through it, that divergence is not shown, so a higher value lets rougher shapes through and a lower one keeps only clean ones.

Every drawing has three parts: a line across the two pivots on the chart, a line across the two histogram values in the indicator window, and a text label, Buy below a bullish pair or Sell above a bearish one. Both lines take the colour of their side at Width 2.

MACD divergence indicator Buy and Sell lines on EURUSD M15 in the MT5 Strategy Tester
EURUSD M15 in the Strategy Tester, 14 to 20 August 2024: Buy and Sell drawings

Bullish Divergence

On USDJPY M15 on the morning of 29 October 2024, the 04:15 candle set a low of 152.851 with the histogram at -0.0703; thirteen candles later, the 07:30 candle dipped to 152.755, 9.6 pips lower, while the histogram read -0.0682.

Below zero, the higher of two readings is the one closer to zero, so -0.0682 stands above -0.0703 even though both carry a minus sign: price made a new low, the MACD bars did not.

The indicator joined the two lows with a DeepSkyBlue line ending at 07:30, printed Buy beneath it and drew the matching line between the two histogram bars in the lower window. With shift at its default of 2, the check for this pair runs two candles after the 07:30 pivot.

What came next on the same chart fits the drawing: the 08:00 candle opened at 152.833 and closed at 153.024, and the 08:15 candle reached 153.070, 31.5 pips above the second low. For anyone reading the shape as a long idea, 152.755 is the level that would cancel it, since trading below it creates a newer and lower low.

Bullish MACD divergence on USDJPY M15, lows 152.851 and 152.755 with a Buy label
USDJPY M15, 29 Oct 2024: the 04:15 and 07:30 lows joined by a DeepSkyBlue line

Bearish Divergence

The bearish example on the same USDJPY M15 chart spans a weekend. The first high formed on Friday 4 October 2024 at 19:30, at 149.003, with the histogram at 0.5315. The second came on Monday 7 October at 01:00: a high of 149.124, 12.1 pips above the first, with the histogram down to 0.1990.

On the clock the gap covers more than two days, yet the pivot distance is counted in candles, not hours. Only 17 M15 candles separate 19:30 on Friday from 01:00 on Monday, well inside the Maximum distance between two pivots of 30, so the pair qualified: a DeepPink line joined the two highs and Sell appeared above the second one.

In the indicator window the second line drops steeply, from 0.5315 to 0.1990, a fall of 0.3325 in the histogram.

Price turned lower through the early Monday session. By 04:45 the candle low stood at 148.342, 78.2 pips under the 149.124 high that carries the Sell label.

Bearish MACD divergence on USDJPY M15 from 4 Oct 19:30 to 7 Oct 01:00 with a Sell label
USDJPY M15: highs of 149.003 and 149.124 joined across the weekend by a Sell line

Indicator Settings

The Inputs tab holds 14 settings: four for the MACD, six for how pivots are found and paired, three for the drawings and one theme choice under its own header.

MACD Divergence MT5 Inputs tab with the default MACD, pivot and colour settings
Inputs tab at default values: 12, 26, 9, Close price, 8-candle pivots, shift 2

A separate theme Setting header keeps Theme, at Auto, apart from the rest. The two colour rows show their swatches next to the names: DeepPink for Sell_Divergence and DeepSkyBlue for Buy_Divergence.

InputDefaultWhat it changes
Fast EMA period12Faster of the two averages behind the MACD histogram
Slow EMA period26Slower of the two averages behind the MACD histogram
Signal SMA period9Smoothing of the dark red Signal line
Applied priceClose pricePrice the MACD is built from; High, Low, Median, Typical and Weighted price are among the other choices
Number of candles for
Pivots calculation
8How many candles decide whether a high or low is a pivot
Maximum distance
between two pivots
30Largest gap, in candles, between the two pivots of one divergence
Minimum distance
between two pivots
5Smallest gap, in candles, between the two pivots
Number of divergences
from pivot
1How many divergence lines may start from one pivot
Number of MACD that
break the line
8Histogram bars allowed to cross the line in the MACD window before the divergence is dropped
shift2Candles the indicator waits after a pivot before it checks for a divergence
Sell_DivergenceDeepPinkColour of the bearish lines and the Sell label
Buy_DivergenceDeepSkyBlueColour of the bullish lines and the Buy label
Width2Thickness of the divergence lines
theme Setting: the colour theme of the indicator
ThemeAutoAuto, Light, Dark or Custom

The pivot inputs are candle counts, so their length in time follows the chart. On M15 the 8-candle pivot setting covers 2 hours and a pair may sit from 1 hour 15 minutes to 7 hours 30 minutes apart; on H1 the same defaults stretch to 8 hours and 5 to 30 hours.

Conclusion

The MACD Divergence MT5 indicator does one job: it finds two swing points 5 to 30 candles apart where price and the MACD histogram disagree, then marks each pair in both windows: a blue or pink line with its Buy or Sell label on the candles, and a twin line across the MACD bars.

Its rules also leave out some divergences a trader may spot by eye. A pair 31 or more candles apart gets no line, and neither does one whose histogram line is crossed by more than 8 bars. Each check waits for the 2-candle shift past the newest pivot, so the line arrives after the turning candle, not on it. With Number of divergences from pivot at 1, a pivot starts one line at most, and the Inputs tab has no alert option, so new drawings are found by watching the chart.

Your rating

Rate this indicator

How useful was this indicator? Click a star.

FAQ

Frequently asked questions

It marks a bullish divergence that passed the indicator's rules: the newer swing low is below the older one, while the MACD histogram at the newer low is higher. In the USDJPY M15 example of 29 October 2024, the low slipped from 152.851 to 152.755 and the histogram rose from -0.0703 to -0.0682.

Three inputs decide it. The two pivots must be between 5 and 30 candles apart, each one needs the 8-candle pivot window to count as a swing, and no more than 8 histogram bars may pass through the line in the MACD window. A divergence that breaks any of these stays undrawn; changing the matching input brings it in.

It compares price with the grey histogram, shown as MACD in the Data Window, and not with the dark red Signal line. By default the bars come from the 12 and 26 exponential averages of the Close price; switching Applied price to High, Low, Median, Typical or Weighted price changes the bars and so the divergences found.

It counts candles, not hours. On USDJPY M15 the highs at 19:30 on Friday 4 October and at 01:00 on Monday 7 October were only 17 candles apart, inside the 30-candle maximum, so they were joined with a Sell line.

Shift sets how many candles the indicator steps away from a pivot before it looks for a divergence. At the default of 2, the drawing for a new low or high is decided two candles after that pivot; a larger value waits longer.

Discussion

Comments

Be the first to comment.

New releases

New MetaTrader 4&5 indicators

View all indicators
01 MT4 Beginner

Trend Continuation Oscillator MT4 Indicator

MT4 oscillator with Bull and Bear Continuation values; a Buy or Sell arrow marks the bar where either one turns positive.

2,907 views 11 downloads
02 MT4 Advanced

ICT Killzones MT4 Indicator

Marks the Asian, London, New York AM and New York PM killzones on MT4 as coloured boxes, with green high and red low lines to each session's end.

2,167 views 13 downloads
ICT Free
03 MT5 Advanced

ICT Killzones MT5 Indicator

Draws the Asian, London, New York AM and New York PM killzones of each day on MT5, with every box's high and low carried on as green and red lines.

2,970 views 14 downloads
ICT Free
04 MT4 Intermediate

RSI Color Candles MT4 Indicator

Paints each MT4 bar in one of four RSI(14) zones and marks with an arrow the bar where RSI first closes over 60 (Buy) or under 40 (Sell).

2,829 views 10 downloads
Useful trading articles

Build a sharper trading framework.

View all articles

Study market structure, liquidity, imbalance, and execution without scattered notes.

01 Beginner

How to Install an Indicator in MetaTrader 4

Install a custom .ex4 indicator in MetaTrader 4: download it, put it in MQL4 Indicators, refresh the Navigator and attach it to a chart.

2 min read
02 Beginner

How to Install an Indicator in MetaTrader 5

Add a custom .ex5 indicator to MetaTrader 5: copy it to MQL5 Indicators, reload the Navigator and attach it, plus fixes when it does not show up.

2 min read