MACD Histogram Alert Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Watching a pane and watching price at the same time is the usual problem. The macd histogram alert indicator marks the event twice: once beside the histogram where it happened, and once on the candles themselves, so whichever window you are looking at shows it.

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: Histogram, BuyMark, SellMark
Alerts popup, push notification, email, sound
Inputs 15

Everything visible

One histogram, two pane marks and chart arrows.

`Histogram` fills deep sky blue at width 2.

`BuyMark` prints lime at the histogram value.

`SellMark` prints red the same way.

`DrawChartArrows` adds a matching arrow on price.

Chart objects carry the `ChartObjectPrefix` `”MHA_”` prefix.

  • Histogram: histogram, deep sky blue, width 2
  • BuyMark: arrow, lime, width 2, arrow code 233
  • SellMark: arrow, red, width 2, arrow code 234
macd histogram alert indicator: A zero crossing marked in both windows, EURUSD H1.
A zero crossing marked in both windows, EURUSD H1.

Working through the maths

The histogram

`FastPeriod` `12` less `SlowPeriod` `26` gives the main line and `SignalPeriod` `9` smooths it. Each column then measures the distance between those two values.

Crossing the reference

Two bars decide a mark. A column moving from at or below zero to above it earns the lime one, and the mirrored move earns red.

A second copy on price

`ChartArrowOffsetPts` `50` places the price-chart arrow that distance from the bar’s high or low, drawn as an object rather than a buffer.

What you are looking at

A zero crossing means the two lines swapped places.

Pane marks sit at the column’s own value.

Chart arrows mark the same bar on price.

`AppliedPrice` `PRICE_CLOSE` feeds both averages.

Chart arrows are drawn over recent bars only.

Warm-up needs about thirty-seven bars.

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

A histogram zero crossing is what reports. `EnableAlerts` decides whether it speaks and a box already appears in the terminal. The push route, the mail route and the file named by `SoundFile` each start closed.

Every Macd histogram alert Indicator input

Core settings

Setting What it does Default
FastPeriod Shorter average, `12`. 12
SlowPeriod Longer one, `26`. 26
SignalPeriod Smoothing length, `9`. 9
AppliedPrice Price the averages read, `PRICE_CLOSE`. PRICE_CLOSE
ChartObjectPrefix Prefix on those objects, `”MHA_”`. MHA_

Display settings

Setting What it does Default
DrawChartArrows arrows on price chart at zero-cross. Also mark the price chart, `true`. on
ChartArrowOffsetPts offset from H/L in points. Points between that arrow and the bar, `50`. 50
ChartBuyColor (see inputs panel) lime
ChartSellColor (see inputs panel) red

Alert settings

Setting What it does Default
EnableAlerts Whether a crossing speaks, `true`. on
EnablePopup A box appears in the terminal, `true`. on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile File the desktop route uses, `”alert.wav”`. alert.wav
macd histogram alert indicator: Inputs panel, the chart-arrow settings under the periods.
Inputs panel, the chart-arrow settings under the periods.

Choosing a timeframe

Histogram zero crossings are the earliest signal this family gives. EURUSD H1 is the reference chart, where they come every day or so. On M5 they crowd together badly. On H4 each one usually marks a real change of pace.

Known limits

A histogram crossing zero is the line crossing its signal.

Early is not the same as reliable.

Chart arrows are objects and survive a timeframe change.

In a range the crossings alternate constantly.

Copy the compiled Macd histogram alert 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.

Download the Macd histogram alert Indicator for MT4 and MT5

The zip holds the compiled Macd histogram alert 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 Histogram crossing zero actually mean?

The main line and its signal have swapped places. Each column measures the distance between them, so it reaches zero exactly when they meet, which is the standard crossing described a different way.

Why does DrawChartArrows repeat the mark?

Because you cannot watch the pane and the candles at once. Setting it true puts a matching arrow on price, so the signal reaches you whichever of the two windows you happen to be looking at.

Where does ChartArrowOffsetPts 50 place its arrow?

Fifty points below the bar’s low for a buy and above its high for a sell. It fixes that distance rather than scaling it, so check the setting on a symbol with a different point size.

Are the chart arrows drawn over all history?

No, only over recent bars. They are chart objects rather than buffer values, and drawing hundreds of them across a long history would slow the chart down for no real benefit.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Macd histogram alert 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