Here's a tweaked version of the ZigZag indicator! Hope it'll be useful to you.
The most expensive function is iBarShift which totally replaces all cycles in the code needed for peaks retrieval.
All information needed to build ZZ for every bar is accessible not only in every moment but also for every extern code.
No suspended peaks
Efficient method to find peaks is available
Works correct at history insertions and when switching TFs.
Perfect for use in EA.
1. Memory requirements. This indicator uses 5 buffers instead of 2 (or even 1) in other similar implementations. But (imho) this is good price for advantages #6 and #7. None of fast ZigZags I have seen can process history insertions without full rebuild. Mine does it. Moreover it does it in efficient way
2. Additional lines are available. This is required to make the data visible for any extern code. These lines should never be visible.
The ZZ is drawn by the channeling principle.
The channel width can be defined in Points (XLab_ZZ) or in Percent (XLab_ZZP)