Opens in a new tab
FX5 MACD Divergence Indicator MT4

FX5 MACD Divergence Indicator MT4

Spotting divergence by eye across dozens of charts gets old fast. This free MT4 indicator automates that scan — it runs a standard MACD in its own window, watches for peak/trough mismatches between the MACD line and price, and marks both classical and hidden (reverse) divergence with arrows and trendlines the moment it finds them.…

Download the FX5 MACD Divergence Indicator MT4

Spotting divergence by eye across dozens of charts gets old fast. This free MT4 indicator automates that scan — it runs a standard MACD in its own window, watches for peak/trough mismatches between the MACD line and price, and marks both classical and hidden (reverse) divergence with arrows and trendlines the moment it finds them. Grab the .mq4 file and you can be scanning for divergence on any chart in a couple of minutes.

What Is the FX5 MACD Divergence Indicator?

This is a standard 12/26/9 MACD (main line and signal line, calculated with MetaTrader’s built-in iMACD) with a divergence-detection layer built on top of it. Rather than just plotting the two lines and leaving pattern-spotting to you, the indicator identifies local peaks and troughs in the MACD line and compares them against the corresponding swing highs and lows in price. When it finds a mismatch — price making a new extreme that the MACD line doesn’t confirm, or vice versa — it drops an arrow and, optionally, draws connecting trendlines on both the price chart and the MACD sub-window.

What makes this version more useful than a basic divergence script is that it distinguishes between two different types of divergence rather than lumping them together:

  • Classical divergence — price makes a higher high (or lower low) while MACD fails to confirm it. This is the “textbook” reversal-warning divergence, marked with a solid trendline.
  • Reverse (hidden) divergence — MACD makes a new extreme while price fails to confirm it. This flavor is more associated with trend-continuation setups and is marked with a dotted trendline so you can tell the two apart at a glance.

Both types are detected for bullish setups (green up-arrow, code 233) at MACD troughs and bearish setups (red down-arrow, code 234) at MACD peaks.

Key Features

  • Full MACD main line and signal line plotted in a dedicated sub-window (fully configurable periods)
  • Automatic peak/trough detection on the MACD line, compared against price highs/lows
  • Separately flags classical divergence (solid lines) and reverse/hidden divergence (dotted lines) for both bullish and bearish setups
  • Optional trendlines drawn directly on the price chart connecting the two swing points that triggered the divergence
  • Optional matching trendlines drawn inside the MACD sub-window itself
  • Built-in terminal Alert() popup when a new divergence forms on or near the current bar

How to Use It

Copy FX5_MACD_Divergence_V1.1.mq4 into your MT4 MQL4/Indicators folder and reload the Navigator, then drag it onto a chart. It opens in its own window with the MACD line (magenta) and signal line (blue) plotted, plus small arrows appearing above or below the MACD line whenever a divergence condition is confirmed.

To trade off it, watch for a bullish arrow forming near a MACD trough alongside price making a new (or failed) low, or a bearish arrow near a MACD peak alongside price making a new (or failed) high. A solid connecting line means classical divergence — treat it as a potential reversal warning against the current move. A dotted connecting line means reverse divergence — these tend to line up more with continuation of the existing trend rather than a reversal, so read them differently. Because divergence, by definition, needs a confirmed peak or trough to compare against, signals only print once enough bars have closed to identify that turning point — don’t expect an arrow on the very bar the extreme forms.

Turn on displayAlert if you want a popup the moment a fresh divergence appears near the current bar (it only fires once per bar to avoid spamming you). Turn off drawIndicatorTrendLines or drawPriceTrendLines individually if you find the chart objects too busy — the arrows will still print either way.

Best Timeframes / Best Use Cases

Because it’s built on a standard 12/26/9 MACD, it behaves the way most traders already expect divergence tools to behave on that setting — it’s most commonly run on H1 through Daily charts, where MACD peaks and troughs represent meaningful swings rather than noise. On very low timeframes, the standard MACD periods can generate frequent, smaller peaks and troughs, so divergence signals will fire more often but with less significance; consider lengthening the MACD periods if you want to run this on M5–M15. It fits naturally into swing-trading and reversal-spotting workflows, and works well as a confirmation layer alongside support/resistance or trendline analysis rather than as a standalone entry trigger.

Final Thoughts

What sets this indicator apart from a plain MACD is the automated, labeled divergence detection — you get classical and hidden divergence flagged separately, with visual trendlines connecting the exact swing points the algorithm used, so you can verify the logic yourself rather than taking a black-box arrow on faith. It won’t catch every divergence a discretionary trader might spot by eye, and it needs price and MACD to form clear, confirmed peaks/troughs before it marks anything, but as a screening tool for divergence across multiple charts it saves a lot of manual scanning time.

Download the FX5 MACD Divergence Indicator MT4
  • fastEMA (default 12) — Fast EMA period passed into the standard MACD calculation.
  • slowEMA (default 26) — Slow EMA period passed into the standard MACD calculation.
  • signalSMA (default 9) — Signal line smoothing period for the MACD.
  • drawIndicatorTrendLines (default true) — Draws a connecting trendline between the two swing points inside the MACD sub-window when divergence is found.
  • drawPriceTrendLines (default true) — Draws a connecting trendline between the two swing points directly on the price chart when divergence is found.
  • displayAlert (default true) — Shows an on-screen MT4 Alert() popup the first time a new divergence forms within the last two bars.

FAQs About the MT4 FX5 MACD Divergence Indicator MT4

One Quick Step

Enter your name and email and check your inbox for the download link.