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 MT4 Indicator

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

Sets each new swing high or low against the MACD histogram, then marks a labelled Buy or Sell line on MetaTrader 4 wherever the two move apart.

The MACD Divergence MT4 indicator checks every new swing high and low of the candles against the MACD histogram on that same candle and marks the pairs that disagree. A bearish pair gets a DeepPink line and a Sell label; a bullish pair gets a DeepSkyBlue line and a Buy label.

MACD Divergence Specifications

The download holds one file, MACD Divergence MT4 - MTIndicatorHub.ex4, which opens in MetaTrader 4 under the title Custom Indicator - MACD Divergence MT4 - MTIndicatorHub.

ItemDetails
PlatformMetaTrader 4 (MT4); also available for MT5
CategoriesOscillators, Signal & Forecast
Indicator typeDivergence, Reversal
Skill levelBeginner
TimeframesAny; shown here on M15
Trading styleIntraday, Day Trading
MarketsForex (shown on USDJPY and EURUSD)
DisplayGrey MACD histogram and dark red Signal line in its own window; Buy and Sell lines with labels on the candles, matching lines on the histogram
AlertsNone
Version1.0

MetaTrader 4's Data Window lists the tool as Indicator window 1 with two rows, MACD and Signal. For the 03:45 candle of 8 November 2024 (USDJPY M15) they read 0.0295 and 0.0056. The MACD row is the histogram value the indicator compares at each pivot, so moving the cursor over two pivot candles shows the pair of numbers behind a drawing.

What Is the MACD Divergence Indicator?

The MACD Divergence indicator reads divergence from the MACD (Moving Average Convergence Divergence). The grey bars in its window are the MACD values, the distance between a 12-period and a 26-period exponential moving average, and the dark red curve is the Signal line, a 9-period simple average of the bars. Divergences are judged on the bars alone; the Signal line plays no part in them.

To find the pairs, the tool first marks pivots: highs and lows that stand out over 8 candles, as set by Number of candles for Pivots calculation. A new pivot is then set against an older pivot of its own type lying 5 to 30 candles earlier. Two lows form a bullish divergence when the later one is lower on the chart but higher on the histogram; two highs form a bearish one when the later high is higher while its bar is lower.

On the histogram side, the indicator lays a straight line from the first histogram value to the second, and when over 8 grey bars cut through it (Number of MACD that break the line is 8 by default), the pair is skipped and nothing is drawn. Raising that number lets bumpier histograms through.

Each accepted pair is drawn twice in its side's colour at Width 2: once between the two pivot candles on the price chart and once between the two matching bars in the MACD window. The Buy or Sell label goes next to the second pivot, under a low and over a high.

MACD divergence indicator for MT4 on EURUSD M15 with Buy and Sell drawings, August 2024
EURUSD M15 between 14 and 20 August 2024: a Buy pair before the 19 August rally and two Sell pairs at its top

Bullish Divergence

USDJPY M15 on 29 October 2024 holds a clean bullish pair. At 04:15 the candle low was 152.851 and the histogram stood at -0.0703. Thirteen candles on, at 07:30, price went 9.6 pips deeper, to 152.755, but the histogram printed -0.0682.

Both readings are negative, so the one nearer zero is the higher: -0.0682 sits 0.0021 above -0.0703, a rising histogram under a falling low.

The indicator answered with a Buy line across the two lows, the Buy label under 152.755 and a twin line over the matching histogram bars. The shift input, 2 by default, put the check on the 08:00 candle, two candles after the low.

That 08:00 candle ran from 152.833 at the open to 153.024 at the close, and at 08:15 the high reached 153.070, 31.5 pips over 152.755. The reading holds only while price stays above 152.755; a trade below it prints a lower low than the one the label marks.

Bullish MACD divergence in MT4 on USDJPY M15, lows of 152.851 and 152.755 on 29 October 2024
29 October 2024, USDJPY M15: Buy line under the 04:15 low and the 07:30 low, with its twin on the histogram

Bearish Divergence

The bearish pair, also on USDJPY M15, has a weekend in the middle. The 19:30 candle of Friday 4 October 2024 made a high of 149.003 while the histogram showed 0.5315; the 01:00 candle of Monday 7 October went 12.1 pips further, to 149.124, as the histogram fell to 0.1990. Price gained 0.121 while the histogram lost 0.3325, more than 60 percent of its first reading.

The calendar shows more than two days between the highs, but the chart shows only 17 M15 candles, since nothing prints over the weekend. Pivot distance is a candle count, so 17 is far below the 30 allowed by Maximum distance between two pivots, and the pair got its Sell line and a Sell label above 149.124.

Three hours and 45 minutes after the second high, the 04:45 candle traded down to 148.342, which is 78.2 pips below 149.124.

Bearish MACD divergence in MT4 on USDJPY M15, highs of 149.003 and 149.124 across a weekend
Friday 19:30 to Monday 01:00 on USDJPY M15: a Sell line over two highs 17 candles apart

Indicator Settings

The MetaTrader 4 build has 13 inputs in one flat list; the last of them, Theme, sits under the theme Setting header.

MACD Divergence MT4 Inputs tab with default values over a USDJPY M15 chart
Inputs tab of the MT4 build at default values, with the USDJPY M15 chart of 11 November 2024 behind it

Unlike the MT5 build, this list has no Applied price row, so the price behind the MACD cannot be picked here. Behind the dialog, three rising highs of 11 November 2024 carry two Sell lines end to end: the middle high closes the first pair and opens the second, while the three MACD peaks under them fall in steps.

InputDefaultWhat it changes
Fast EMA Period12Length of the quicker exponential average inside the MACD
Slow EMA Period26Length of the slower exponential average inside the MACD
Signal SMA Period9Averaging length for the Signal line
Number of candles for
Pivots calculation
8Candles a high or low must stand out over to count as a pivot
Maximum distance
between two pivots
30Widest gap, in candles, allowed inside one pair
Minimum distance
between two pivots
5Narrowest gap, in candles, allowed inside one pair
Number of divergences
from pivot
1Divergence lines a single pivot may start
Number of MACD that
break the line
8Grey bars allowed through the histogram line before the pair is skipped
shift2Candles between a pivot and the divergence check
Sell_DivergenceDeepPinkColour used for every bearish drawing
Buy_DivergenceDeepSkyBlueColour used for every bullish drawing
Width2Thickness of both lines of a drawing
theme Setting: header row above the theme choice
ThemeAutoColour theme the indicator uses

In time, the 8-candle pivot window lasts 40 minutes on M5 and 32 hours on H4, and the 5 to 30 candles between paired pivots become 25 minutes to 2 hours 30 minutes on M5 and 20 to 120 hours on H4.

Conclusion

MACD Divergence MT4 does one comparison, a pivot on the chart against the MACD bar under it, and every pair that passes the distance and crossing tests is drawn as a labelled line in both windows.

The MT4 build has no alert input, so a new line is found only by looking at the chart, and at shift 2 each line appears two candles after its pivot, never on the turning candle.

Your rating

Rate this indicator

How useful was this indicator? Click a star.

FAQ

Frequently asked questions

Not from the Inputs tab. The MetaTrader 4 build offers the three MACD periods, 12, 26 and 9, but no Applied price row, so the price source of the histogram is fixed in this build.

One high can end one pair and start the next. On EURUSD M15, late on 19 August and early on 20 August 2024, three highs edged up while the MACD bars under them kept falling, so the indicator drew a Sell line from the first high to the middle one and a second from the middle high to the third. Number of divergences from pivot, 1 by default, caps how many lines start from one pivot.

That line links the histogram values at the same two pivots, so the disagreement is visible in both windows: across the 4 to 7 October 2024 weekend on USDJPY M15, the price line climbs from 149.003 to 149.124 while the histogram line drops from 0.5315 to 0.1990. If over 8 bars cut through that line, the pair is dropped.

Below zero, a shorter bar is a higher value. On USDJPY M15 on 29 October 2024 the histogram went from -0.0703 at the first low to -0.0682 at the second, while the low dropped from 152.851 to 152.755, so the bars were rising under a falling low and the Buy line was drawn.

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,908 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,168 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,971 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,830 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