Indicators/probuilder · probacktest · proorder · proscreener

ZigZagPoint

ZigZagPoint in ProBuilder draws the zig-zag indicator using a fixed point threshold instead of a percentage filter. Syntax, parameters, examples, gotchas.

Syntax

probuilder
ZigZagPoint[Zp](price)

Parameters

NameTypeDefaultDescription
ZpnumbernoneReversal threshold in points (price units). A new pivot is confirmed only after price moves at least Zp points against the current swing.
priceprice sourcecloseThe series pivots are detected on. Accepts close, open, high, low, or a custom variable.

Formula

No closed-form formula exists. The construction rule is:

code
1. Track the extreme of the current swing since the last confirmed pivot.
2. When price moves at least Zp points away from that extreme in the opposite
   direction, the extreme becomes a pivot and the swing reverses.
3. Each bar's output is the value of the straight line joining consecutive pivots.

How it works

ZigZagPoint filters price action the same way ZigZag does, but the reversal threshold is expressed in absolute points rather than percent. On an index trading at 15000, ZigZagPoint[100] ignores every counter-move smaller than 100 points; on the same chart ZigZag[5] would require a 750-point retracement. The point-based version is the natural choice when thinking in instrument-specific units, ticks, pips, or index points, or when a strategy's risk parameters are already defined in points.

The trade-off is that a fixed point threshold does not adapt to price level. A filter tuned for an instrument at 5000 becomes twice as permissive, in relative terms, if the instrument doubles to 10000. Long historical studies on growing instruments usually behave more consistently with the percentage variant.

Like all zig-zag constructions, the most recent leg is provisional. Until price completes a full Zp-point reversal, the last pivot can be relocated and the final segment redrawn. The indicator therefore describes past structure, swing highs and lows, wave patterns, pivot-based support and resistance, and is unsuitable as a real-time entry trigger.

Examples

Example 1, Zig-zag with a 10-point filter (Indicator)

probuilder
// Ignore all counter-moves smaller than 10 points
myZigZag = ZigZagPoint[10](close)
RETURN myZigZag

The source example: only reversals of at least 10 points create a new pivot, so the line traces the major swings and skips the noise between them.

Example 2, Marking confirmed pivot levels (Indicator)

probuilder
// Track the most recent zig-zag pivot value as a horizontal reference
zz = ZigZagPoint[50](close)

IF (zz > zz[1] AND zz[1] < zz[2]) OR (zz < zz[1] AND zz[1] > zz[2]) THEN
  // The line changed direction on the previous bar, record the pivot
  lastPivot = zz[1]
ENDIF

RETURN zz AS "ZigZagPoint", lastPivot AS "Last pivot"

Detects direction changes in the zig-zag line and stores the pivot value, producing a stepped line of past swing levels usable as support and resistance references.

Example 3, Screening for proximity to the last swing level (ProScreener)

probuilder
// Instruments trading within 20 points of their zig-zag line
zz = ZigZagPoint[100](close)
nearSwing = ABS(close - zz) < 20
SCREENER[nearSwing](close - zz AS "Points vs ZZ")

Selects instruments whose price sits within 20 points of the 100-point zig-zag line. As with all zig-zag output, the latest leg can repaint, so results reflect the current provisional structure.

Interpretation

The output is read structurally rather than as a signal line. A sequence of rising pivots, higher highs and higher lows, describes an uptrend at the chosen resolution; falling pivots describe a downtrend. Confirmed pivots often serve as reference levels: prior swing highs as resistance, prior swing lows as support, and pivot-to-pivot distances as measures of typical swing size for position sizing or target placement.

The Zp setting controls resolution. Small values expose minor structure, large values reduce the chart to a handful of major waves. Because the threshold is absolute, an appropriate value depends entirely on the instrument's price level and volatility.

Common errors and gotchas

  • Points versus percent. ZigZagPoint[5] means 5 price units, not 5 percent. Porting a setting from ZigZag without conversion changes the indicator's behaviour completely.
  • Trading the repainting leg. The last segment is redrawn until a full Zp-point reversal completes. Rules that read recent ZigZagPoint values use information that did not exist in real time, which inflates backtests.
  • One threshold across many instruments. A 50-point filter is coarse on one instrument and invisible on another. In screeners covering mixed lists, the percentage-based ZigZag gives more comparable results.
  • Forgetting the instrument's point size. On instruments with fractional pricing, one point is one full price unit, not one tick. Check POINTSIZE when converting from ticks or pips.
  • ZigZag, the same construction with a percentage threshold.
  • Highest, highest value over N bars, a non-repainting alternative.
  • Lowest, lowest value over N bars.
  • SAR, parabolic stop and reverse trend tracker.
  • Supertrend, ATR-based trend-following line.
  • POINTSIZE, value of one point for the instrument.
  • Average, conventional moving-average smoothing.
  • DRAWSEGMENT, draws custom segments between coordinates.