Skip to content

ZigZag

Indicators · Levels

ZigZag node on the canvas

ZigZag pivots filtered by a percent or k x ATR reversal threshold.

ZigZag filters out the noise and draws only the significant swings — straight lines connecting the major highs and lows, ignoring any move smaller than a threshold you set. It strips a chart down to its skeleton: the big zig-zag of meaningful turning points, with all the small wiggles removed. It's invaluable for seeing structure clearly, identifying swing points for pattern recognition, and as a foundation for Elliott Wave or harmonic analysis.

How it works

The block tracks the running extreme in the current direction and registers a pivot only when price reverses from it by at least the threshold. Smaller moves are ignored, so the ZigZag line changes direction only at confirmed significant pivots, and Pivot ↑ / Pivot ↓ fire on the bars where a high or low pivot confirms.

It does not repaint. The pivot flag and the step-line value are emitted at the confirmation bar — the bar where the reversal threshold is finally crossed — not back-dated to the pivot bar. Every value therefore depends only on bars up to and including itself, so a ZigZag backtest is realizable and matches the exported strategy. (The classic charting-package ZigZag does back-write the pivot to its own bar and repaints; this one deliberately doesn't. The trade-off is that the line steps a few bars late, which is exactly the lag a live trader would really have had.)

Threshold mode decides how far "far enough" is:

  • percent — a fixed percentage of the running extreme. Simple, but it means something different on every instrument and timeframe: the same 2% that produces a couple of hundred pivots on daily crypto produces a flat line on intraday forex. If you use this mode, tune it per market (quiet FX intraday ≈ 0.2–0.3, FX H4 ≈ 0.5, daily FX/crypto 2+).
  • atr — k × ATR, the reversal measured in units of that instrument's own volatility, using the same ATR the ATR block computes. One k behaves sensibly everywhere, which is why this is the mode to reach for when you don't want to re-tune per symbol.

When to use it

Use ZigZag to see and measure structure. It's excellent for visually identifying the swing highs and lows that define a trend, for measuring the size and rhythm of legs, and as the backbone of pattern-based methods (Elliott Wave, harmonics, ABCD). The threshold is the key dial — raise it to keep only major swings, lower it to capture minor ones.

Example

ZigZag on the EURUSD H1 chart

ZigZag on EURUSD · H1

Read structure at a glance: wire bars into ZigZag, set Threshold mode to atr with k = 3, and the chart skeletonises into major swings on forex, stocks and crypto alike without touching the dial. Use the confirmed pivots to define higher-high / lower-low structure, and pair with Swings and Market Structure. Study it in the Tester.

Tips & gotchas

  • Prefer atr mode — a percent threshold has no single good value across markets; k × ATR scales itself.
  • The line steps at confirmation, not at the pivot bar — that's what makes it honest rather than hindsight, but it does mean the drawn corner sits to the right of the actual high or low.
  • Export: the percent mode exports to MT5 / TradingView / C# / Python. The atr mode is not in the exporters yet — a strategy using it exports with that block flagged unsupported rather than silently emitting the percent formula.
  • Threshold sets the scale — high = major swings only, low = minor ones too.
  • The backbone of pattern methods — Elliott, harmonics, ABCD.

Inputs

Socket Type What to wire in
Bars bars / series Price bars

Outputs

Output Type Plots as Description
ZigZag series Line ZigZag line — changes only at confirmed pivots
Pivot ↑ signal Signal arrows Confirmed high pivot bar
Pivot ↓ signal Signal arrows Confirmed low pivot bar

Parameters

Parameter Type Default What it does
Threshold mode choice (percent, atr) percent percent = fixed % reversal (tune per instrument); atr = k x ATR, self-scaling to the instrument's own volatility
ATR period number · 2–200 14 Lookback for the ATR that sizes the reversal, in atr mode.
ATR multiple (k) number · 0.1–20.0 3.0 Reversal must exceed k x ATR to confirm a pivot, in atr mode.
Threshold (%) number · 0.1–50.0 0.5 Minimum percent reversal to confirm a pivot. Scale it to the instrument: quiet FX intraday ~0.2-0.3, FX H4 ~0.5, daily FX/crypto 2+. Prefer atr mode, which scales itself.
Line color colour #ffb300

Reference auto-generated from the block catalog · category Indicators.