ZigZag Alert Indicator: Four Channels Per New Pivot

Written by Dominic Walsh · Published · Last updated

The zigzag alert indicator is a standard ZigZag with a different job. Swing detection uses the classic Depth, Deviation and Backstep method. The alerting is what sets it apart. A guard stops a pivot reporting too early.

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 Main price chart
Plots 3: ZigZag Alert, Swing Low (BUY bias), Swing High (SELL bias)
Alerts popup, push notification, email, sound
Inputs 17

What the Zigzag alert Indicator draws on the chart

An aqua `ZigZag Alert` section joins each confirmed pivot to the next.

`Swing Low (BUY bias)` uses arrow 233 in spring green.

`Swing High (SELL bias)` uses arrow 234 in orange red.

A status panel reports the last pivot type, price and age.

  • ZigZag Alert: section, aqua, width 2
  • Swing Low (BUY bias): arrow, spring green, width 2, arrow code 233
  • Swing High (SELL bias): arrow, orange red, width 2, arrow code 234
Zigzag alert indicator swing legs, pivot arrows and status panel on EURUSD H1.
Zigzag alert indicator swing legs, pivot arrows and status panel on EURUSD H1.

How the Zigzag alert Indicator calculates its values

Three passes build the swings

`Depth` `20` sets the look-back window for an extreme. `Deviation` `8` points filters out moves too small to matter. `Backstep` `4` clears extremes that sit too close together.

Alternation gets forced

A second pass walks the maps and forces highs and lows to alternate. A same-direction extreme that beats the current one moves the pivot forward. No second pivot gets added.

The confirm guard is the point

A ZigZag pivot can move while its bar is recent. `ConfirmBars` `2` makes the tool wait two closed bars before alerting. That stops a message firing on a pivot that then vanishes.

How to read the signals

A new swing low reads as buy bias and a new swing high as sell bias.

The section line only ever connects confirmed pivots.

Arrows sit `ArrowOffsetPts` `20` points beyond the pivot itself.

The panel tells you how many bars have passed since the last pivot.

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

This build exists for its alerting. `EnableAlerts` is the master switch and ships true, `EnablePopup` gives the popup, and `EnablePushNotify`, `EnableEmail` and `EnableSound` add the phone, mail and `SoundFile` routes. Each pivot reports once.

Every Zigzag alert Indicator input

Core settings

Setting What it does Default
Depth Depth (swing look-back window, bars). Look-back window for an extreme, in bars, default `20`. 20
Deviation Deviation (points). Smallest move that counts, in points, default `8`. 8
Backstep Backstep (bars). Bars that must separate two extremes, default `4`. 4
ConfirmBars Bars a pivot must age before it is alertable. Closed bars a pivot must age before alerting, default `2`. 2

Display settings

Setting What it does Default
ArrowOffsetPts Arrow offset from the pivot (points). Points between an arrow and its pivot, default `20`. 20
ShowPanel Show on-chart status panel. Show the status readout, default `true`. on
PanelX Panel X (px). 12
PanelY Panel Y (px). 22
PanelTitleColor Panel title colour. aqua
PanelTextColor Panel text colour. gainsboro

Alert settings

Setting What it does Default
MaxBars History bars to scan (0 = all). History the scan covers, default `3000`. 3000
EnableAlerts Master alert switch. Master alert switch, default `true`. on
EnablePopup Popup alert. Popup in the terminal, default `true`. on
EnablePushNotify Push notification to phone. Push to the phone, default `false`. off
EnableEmail Email alert. off
EnableSound Sound alert. off
SoundFile Sound file. alert.wav
Zigzag alert indicator inputs panel with Depth, Deviation and ConfirmBars.
Zigzag alert indicator inputs panel with Depth, Deviation and ConfirmBars.

Settings that fit your chart

ZigZag settings are relative to the instrument. EURUSD H1 is the reference chart. There `Deviation` `8` points is a small filter and pivots come often. On a wider instrument raise it. Higher timeframes give fewer, larger swings.

When the Zigzag alert Indicator fails

A ZigZag pivot can still move before it confirms, which is why the guard exists.

`Deviation` `8` counts points, so it needs setting per instrument.

The last leg on the chart is always provisional, however clean it looks.

Copy the compiled Zigzag 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.

Background reading on the method behind the Zigzag alert Indicator: Buying in (securities) on Wikipedia, Money Flow Index MFI at StockCharts ChartSchool.

Download the Zigzag alert Indicator for MT4 and MT5

The zip holds the compiled Zigzag 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 ConfirmBars 2 protect against?

A pivot that reports and then moves. ZigZag can shift its newest extreme as bars arrive. Alerting at once would sometimes announce a swing that never existed, so the tool waits two closed bars.

How does Deviation 8 filter swings?

It sets the smallest move, in points, that can register as a new extreme. Eight points is a light filter on a five-digit pair. Raise it to skip minor wiggles, especially on instruments with a different point size.

What does the Backstep 4 pass do?

It stops two extremes forming within four bars of each other. Without that spacing the ZigZag produces clustered pivots and the resulting legs become too short to describe real structure.

Does the ZigZag Alert line repaint?

The newest leg can still change until its pivot confirms. That is true of every ZigZag. `ConfirmBars` keeps the alerts honest, but the drawn line will always adjust its last segment.

Are results guaranteed?

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

Category: this is part of our Support and Resistance collection. Browse more Support and Resistance 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