State-Based Design for Fast, Non-Redrawing ZigZag Indicators
Summary
This article presents a state-based template for ZigZag indicators that switch direction when price crosses a slowing level. For the example, the level trails the current segment's extreme by a fixed point distance: a rise from a temporary low or fall from a temporary high confirms a reversal. The indicator tracks direction, temporary and confirmed extrema, and their bar coordinates, then updates that state as each completed bar arrives. The article also discusses initialization, historical recalculation, and implementation choices that affect how extrema are confirmed.
Working only with completed bars is proposed to make historical calculations consistent with live operation, though it introduces a delay that can be reduced by using smaller timeframes. The author explains that the update order favors momentum when a bar contains both a new extreme and a potential reversal, and that this can omit an intrabar extreme. The template can support other slowing-level rules, but the article provides no trading-performance evidence; the closing optimization advice is general rather than a benchmark.
Key ideas
- A ZigZag can be modeled as state variables updated by a transition rule on each completed bar.
- The example sets its reversal threshold a fixed distance behind the current segment extreme.
- Confirmed peaks and troughs are recorded when price crosses the moving slowing level.
- Completed-bar processing supports consistency between historical and live calculations but adds delay.
- The order of checks makes an explicit momentum preference when a bar's high and low create ambiguity.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.