Swing ZZ Zigzag Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The classic MetaTrader zigzag uses depth, deviation and backstep. The swing ZZ zigzag indicator keeps those three settings and adds a size filter tied to the average range, so small swings in fast markets drop out. Every remaining swing low gets a buy mark and every swing high a sell mark.

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: Swing ZZ, Swing Buy, Swing Sell
Alerts popup, push notification, email, sound
Inputs 12

Output you can see

A zigzag line and two marks on price.

`Swing ZZ` joins swing highs and lows.

`Swing Buy` prints lime under each swing low.

`Swing Sell` prints red over each swing high.

Marks sit `ArrowOffsetPts` `15` points from the bar.

No panel is drawn.

  • Swing ZZ: section
  • Swing Buy: arrow, arrow code 233
  • Swing Sell: arrow, arrow code 234
swing zz zigzag indicator: ATR-filtered zigzag with swing marks, EURUSD H1.
ATR-filtered zigzag with swing marks, EURUSD H1.

The calculation in three parts

Classic settings

`Depth` `12` bars are searched for each extreme. `Backstep` `3` bars must pass before a new extreme replaces the last.

Size filter

A new swing must move the larger of `Deviation` `5` points and `MinSwingATR` `0.50` of an `ATRPeriod` `14` range.

Marks

Each zigzag low gets a buy mark and each high a sell mark. A message goes out when a new pivot appears.

How to read what it shows

Each segment is one swing.

Lime marks sit at swing lows.

Red marks sit at swing highs.

The newest leg can still move.

Older pivots stay fixed once passed.

Warm-up needs about fifteen bars.

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

A new pivot sends a BUY or SELL message through `EnableAlerts`. Only the popup is live at the start.

Every Swing ZZ Zigzag Indicator input

Core settings

Setting What it does Default
Depth Depth (bars scanned for each extreme). Bars searched for each extreme, `12`. 12
Deviation Deviation (min points between extremes). Smallest move in points, `5`. 5
Backstep Backstep (bars before a new extreme). Bars before a new extreme, `3`. 3
ATRPeriod ATR period for adaptive swing filter. Range window, `14`. 14
MinSwingATR Min swing size as ATR multiple (0=off). Smallest swing in ranges, `0.50`. 0.50

Display settings

Setting What it does Default
ArrowOffsetPts Arrow gap from bar high/low (points). Mark gap in points, `15`. 15

Alert settings

Setting What it does Default
EnableAlerts Master alert switch, `true`. on
EnablePopup Popup, `true`. on
EnablePushNotify Phone route, `false`. off
EnableEmail (see inputs panel) off
EnableSound Speaker, `false`. off
SoundFile (see inputs panel) alert.wav
swing zz zigzag indicator: Inputs panel, classic zigzag settings above the ATR filter.
Inputs panel, classic zigzag settings above the ATR filter.

Where it works best

A 12-bar depth gives swings of a day or two on the hourly EURUSD screenshot. On M15 it maps session swings. On D1 each leg spans weeks.

When it is unreliable

The last pivot, and its mark, can move until the next swing forms.

Marks show turns after the fact.

Half a range is still small on quiet charts.

Popups are the single route on by default.

Copy the compiled Swing ZZ Zigzag 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 Swing ZZ Zigzag Indicator for MT4 and MT5

The zip holds the compiled Swing ZZ Zigzag 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 MinSwingATR 0.50 add to the classic zigzag?

A size floor tied to volatility. A swing must move at least half of the 14-bar average range, so small wiggles in fast markets no longer create new legs.

Can a Swing Buy mark move after it prints?

Yes, on the newest leg. If price makes a lower low before the next swing high forms, the pivot and its mark shift to the new low. Older marks stay fixed.

How does Backstep 3 limit pivots?

A new extreme must come at least three bars after the last one to replace it. That stops the line from jumping on every bar during a spike.

When does the swing ZZ message fire?

When a new zigzag pivot appears on the chart. Because the newest pivot can still move, treat the message as a heads-up rather than a fixed signal.

Are results guaranteed?

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