A Channel-Based ZigZag Indicator for Fast Peak Retrieval
Summary
This document explains an implementation approach for a ZigZag indicator that identifies swing peaks using a channel. The channel width can be set in points or as a percentage. For peak lookup, it replaces repeated bar searches with a binary search over timestamps, and exposes additional buffers so an Expert Advisor can access historical peak information. An example indicator marks five alternating peaks, including the currently forming one.
The author claims faster retrieval, correct handling of inserted history and timeframe changes, and suitability for automated strategies, but provides no benchmark results. The approach uses five buffers, increasing memory use compared with simpler versions, and adds lines intended for programmatic access. The example may behave incorrectly when zero-bar mode is enabled, which is disabled by default and discouraged for Expert Advisor use. As with ZigZag methods generally, a forming swing can change as new prices arrive, so historical peak availability should not be mistaken for a guaranteed live signal.
Key ideas
- The ZigZag draws turning points using a channel whose width is configurable in points or percentage terms.
- Timestamp binary search is used to locate peaks instead of repeated bar-shift searches.
- Extra indicator buffers make peak data available to automated strategies across historical bars.
- The design uses more memory than a two-buffer approach, and zero-bar mode may cause errors.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.