Summary
ZigZagSwingDetector is RTTA's streaming implementation of: Close-based swing detector that filters price moves below a percentage threshold and emits confirmed pivots.
Update API
result = rtta.ZigZagSwingDetector().update(close)
The update(...) call consumes one observation using close. advance(...)
uses the same inputs when the caller wants to update state without materializing
a Python return value.
Theory Of Operation
ZigZagSwingDetector maintains the current swing direction, the active extreme, and the last confirmed pivot. A new pivot is confirmed only after price reverses from the active extreme by the configured percentage, which filters smaller oscillations out of the swing path.
Recurrence
Let \(z_t = close_t\) denote the observation consumed by one
update(...) call and let \(\theta\) denote constructor parameters such as
window lengths, thresholds, and smoothing constants.
When direction flips, the previous extreme becomes the confirmed pivot and the current close starts the new extreme search.
update(...) returns a result struct with fields value, direction, pivot, pivot_index.
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in class ZigZagSwingDetector.
