MACD Crossover Alert Indicator: The Plain Version

Written by Dominic Walsh · Published · Last updated

The macd crossover alert indicator adds one thing to the standard tool: it tells you. Main line, signal line and histogram all appear exactly as they should. When the main line crosses its signal on a closed bar, four alert channels stand ready to say so.

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: MACD, Signal, Histogram
Alerts popup, push notification, email, sound
Inputs 10

What the MACD Crossover Alert Indicator draws on the chart

MACD is the dodger blue main line.

Signal is the orange red line it crosses.

Histogram is the silver bar series showing the gap between them.

A reference line marks zero.

  • MACD: line, dodger blue, width 2
  • Signal: line, orange red, width 2
  • Histogram: histogram, silver
MACD crossover alert indicator on EURUSD H1 with the standard three plots
MACD crossover alert indicator on EURUSD H1 with the standard three plots

How the MACD Crossover Alert Indicator calculates its values

Reading the terminal values

iMACD supplies both lines at `FastPeriod` `12`, `SlowPeriod` `26` and `SignalPeriod` `9`, using `AppliedPrice` as the source. Taking them from the built-in call means the plot matches every other MACD on the same chart.

Deriving the histogram

HistBuf takes the main line minus the signal. That difference crosses zero at precisely the moment the two lines cross each other, which is why the histogram is worth watching on its own.

Where the pane stays blank

Warmup covers `SlowPeriod` plus `SignalPeriod` plus two bars. The loop stops short of that, so a partial calculation never appears as a real reading at the left edge.

How to read the signals

Above zero the fast average leads the slow one.

A crossing is the moment the gap between them changes sign.

The histogram shrinking means the two lines are converging.

MACD values scale with price, so the numbers mean nothing across instruments.

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

Four channels hang off `EnableAlerts`, which starts on, with `EnablePopup` joining it. `EnablePushNotify`, `EnableEmail` and `EnableSound` all begin false. `SoundFile` picks the clip. The check reads a closed bar, one message per bar.

Every MACD Crossover Alert Indicator input

Core settings

Setting What it does Default
FastPeriod Fast average length, default `12`. 12
SlowPeriod Slow average length, default `26`. 26
SignalPeriod Signal average length, default `9`. 9
AppliedPrice Price the calculation reads, default PRICE_CLOSE. PRICE_CLOSE

Alert settings

Setting What it does Default
EnableAlerts Master switch for the line cross alerts, default `true`. on
EnablePopup Terminal dialog on a line cross, default `true`. on
EnablePushNotify Phone push on a line cross, default `false`. off
EnableEmail Mail delivery on a line cross, default `false`. off
EnableSound Sound playback on a line cross, default `false`. off
SoundFile Wav clip for the cross alert, default `alert.wav`. alert.wav
MACD crossover alert indicator inputs: FastPeriod, SlowPeriod, SignalPeriod, AppliedPrice
MACD crossover alert indicator inputs: FastPeriod, SlowPeriod, SignalPeriod, AppliedPrice

Settings that fit your chart

The 12, 26 and 9 defaults came from daily charts and still read well there. EURUSD H1 is the reference chart, where `SlowPeriod` at `26` covers a day. On M5 the two lines cross several times a session. On H4 a crossing is worth stopping for.

When the MACD Crossover Alert Indicator fails

Two averages of the same series cross late, whatever the settings.

In a range the lines cross back and forth with nothing behind either.

A crossing far from zero means something different to one near it, and the tool does not distinguish.

Copy the compiled MACD Crossover 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 Crossover Alert Indicator for MT4 and MT5

The zip holds the compiled MACD Crossover 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 AppliedPrice change here?

The series the whole calculation reads. PRICE_CLOSE is the default and matches the standard definition. A median or typical setting brings the wicks in, which shifts both lines slightly and moves crossings by a bar here and there.

Why does the Histogram plot exist?

Because it makes the gap between the two lines visible. HistBuf takes main minus signal, so it crosses zero at the same instant the lines cross. Watching it shrink often gives earlier warning than the crossing itself.

Should SlowPeriod stay at 26?

It keeps the reading comparable with every other MACD you have seen, which is worth a lot. Shortening it makes crossings arrive sooner and far more often. Most traders change the timeframe rather than the periods.

Does a MACD crossing above zero mean more?

Many traders think so, since it happens while the fast average already leads. The tool itself does not distinguish, so both cases raise the same alert. Reading the crossing against the zero line is left to you.

Are results guaranteed?

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