Skip to content
All library documents

Zigzag Library for Pivot Data, Multilevel Waves, and Indicator Ratios

Article TradingView scripts

Summary

This Pine library defines reusable data structures and methods for calculating and drawing zigzags. Pivots can store their chart coordinates, direction, level, component relationships, and ratios describing price movement, wave size, and bar counts. The library also supports indicator values attached to pivot candles, allowing ratios and readings from multiple indicators to be associated with zigzag turns.

The design includes single and recursive multilevel zigzags, where larger waves can retain their lower-level components and micropivots. Drawing methods support labels and lines, including continuous updates when a recent pivot changes and handling for two pivots on one bar. The document is primarily a technical library reference, not a standalone trading strategy: it specifies calculation and display structures but gives no entry or exit rules, predictive validation, or performance evidence. Users would need to examine the complete library and the behavior of any indicator built with it before relying on its pivots or ratios.

Key ideas

  • Pivots can carry price, direction, wave ratios, component data, and attached indicator readings.
  • Recursive levels allow larger zigzag waves to retain their smaller subwaves and micropivots.
  • The library provides drawing methods for fresh plots and continuously updated zigzag lines and labels.
  • The document describes infrastructure for analysis and does not establish a trading edge or performance record.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.