MACD Histogram Indicator: Just The Gap, In Two Colours

Written by Dominic Walsh · Published · Last updated

The macd histogram indicator throws away the two lines and keeps the difference. What remains is the gap between MACD and its signal. Columns carry that gap. Above zero it is positive, and below zero it has turned.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Separate window (levels 0)
Plots 3: Hist+, Hist-, Zero
Alerts popup, push notification, email, sound
Inputs 10

The visual side

`Hist+` fills dodger blue columns above the zero line.

`Hist-` fills crimson columns below it.

A dim gray `Zero` line runs through the middle.

Neither MACD nor its signal appears anywhere in the pane.

  • Hist+: histogram, dodger blue, width 2
  • Hist-: histogram, crimson, width 2
  • Zero: line, dim gray, width 1
Macd histogram indicator two-colour columns and zero line on the EURUSD H1 chart.
Macd histogram indicator two-colour columns and zero line on the EURUSD H1 chart.

What the code actually computes

Standard settings underneath

iMACD runs at `InpFastEMA` `12`, `InpSlowEMA` `26` and `InpSignalSMA` `9` on `InpAppliedPrice` `PRICE_CLOSE`. Subtracting the signal from the main line gives the plotted value.

One value, two colours

Both column buffers receive the same number. Only the sign decides which one gets it. So the columns cannot disagree where they meet the zero line.

Zero crossings raise the alert

A message fires when the value moves from at or below zero to above it, or the reverse. That crossing is the moment the two hidden lines swap places.

Reading the result

Column height shows how far apart the two hidden lines have travelled.

Shrinking columns mean they are closing in.

A zero crossing is the same event a two-line build would flag as a signal.

The pane scale runs in price units, so it shifts with the instrument.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`InpEnableAlerts` gates all four routes and starts true with `InpPopupAlert`. `InpPushAlert` reaches the mobile app. `InpEmailAlert` sends mail. `InpSoundAlert` plays `InpSoundFile`. Those three arrive false, and one message goes out per closed bar.

Every MACD Histogram Indicator input

Core settings

Setting What it does Default
InpFastEMA Fast EMA period. Quick average inside the study, default `12`. 12
InpSlowEMA Slow EMA period. Slow average inside the study, default `26`. 26
InpSignalSMA Signal SMA period. Average taken off the main line, default `9`. 9
InpAppliedPrice Applied price. Price the study reads, default `PRICE_CLOSE`. PRICE_CLOSE

Alert settings

Setting What it does Default
InpEnableAlerts Alert on zero-cross. Gate above the four delivery routes, default `true`. on
InpPopupAlert Popup alert. Window inside MetaTrader on a zero cross, default `true`. on
InpPushAlert Push notification. Message to the mobile app on a zero cross, default `false`. off
InpEmailAlert Email alert. Mail on a zero cross, default `false`. off
InpSoundAlert Sound alert. Clip on a zero cross, default `false`. off
InpSoundFile Sound file. Name of that clip, default `”alert.wav”`. alert.wav
Macd histogram indicator inputs panel with InpFastEMA, InpSlowEMA and InpSignalSMA.
Macd histogram indicator inputs panel with InpFastEMA, InpSlowEMA and InpSignalSMA.

Symbols and timeframes

The 12, 26 and 9 combination was built for daily bars. EURUSD H1 is the reference chart. Zero crossings arrive every day or two there. On M5 they come constantly. Daily charts give the study as intended.

Its blind spots

Without the two lines you cannot see whether both sit above zero.

Columns shrink before every crossing, so a turn can look close for a while.

Three stacked averages put each crossing well behind the turn in price.

Copy the compiled MACD Histogram Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Background reading on the method behind the MACD Histogram Indicator: Market depth on Wikipedia, Guidelines For Applying Elliott Wave Theory at StockCharts ChartSchool.

Download the MACD Histogram Indicator for MT4 and MT5

The zip holds the compiled MACD Histogram Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does the Hist+ column actually measure?

The MACD main line minus its signal line. A positive value means the main line sits above the signal, and the height shows by how much. A two-line build would draw that same number as a gap.

Why drop the MACD and signal lines?

Because the gap between them carries the crossing on its own. One series is easier to read than two. The cost is losing sight of where both lines sit against zero.

What raises the InpEnableAlerts message?

The value crossing zero in either direction. That is the moment the two hidden lines swap. The check reads the last two completed bars, so a value already past zero raises nothing new.

Does InpSignalSMA 9 use a simple average?

The name says so, and the terminal builds the signal as a simple average of the MACD line. Nine bars is the textbook value. Lengthening it delays every crossing.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the MACD Histogram Indicator as one input. Always backtest before trading live.

Category: this is part of our Oscillators collection. Browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment