Designing a Modular ZigZag Indicator and Accounting for Its Delays
Summary
The article develops a modular approach to ZigZag indicators in MetaTrader 5. It frames the indicator as a line connecting local highs and lows, then separates its implementation into source-data selection, direction-change rules, and plotting. Possible sources include price series such as highs, lows, or closes, as well as indicator values. Direction rules can be based on local extrema or reversals from a tracked extreme, enabling variations to share common components.
A central caveat is that ZigZag turning points are only confirmed after subsequent price movement. The last segment can change as new bars arrive, so historical peaks and troughs are not immediately actionable signals; the indicator can visually simplify price structure but may mislead if treated as a real-time reversal detector. The article also explains how the modular indicator can be called from other programs. It presents an implementation framework rather than performance evidence, and notes that an overly configurable universal indicator can become cumbersome, making separate variants more practical.
Key ideas
- A ZigZag connects local highs and lows, with configurable source data and reversal rules.
- Its implementation can be separated into data selection, direction detection, and plotting components.
- Turning points are confirmed only after later price movement, and the latest segment can change.
- The indicator can help visualize price swings and support or resistance areas, but historical turns are not immediate trading signals.
- Highly configurable indicators can become difficult to use, so focused variants may be more practical.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.