Skip to content
All library documents

A Spread-Aware ZigZag and Class for Extracting Price-Swing Data

Article MQL5 articles

Summary

The article develops a modified ZigZag indicator and a class intended to make its swing data easier to retrieve and study. Its key adjustment is to use maximum bid prices for highs and minimum ask prices for lows, incorporating spread into the plotted turning points. This is meant to make the displayed swings more consistent with prices at which trades could be executed, especially when spreads widen. A minimum impulse threshold controls how far price must move before a new opposing segment is accepted, and the indicator can expose both selected extremes and all detected points.

The article then describes tools for reading ZigZag data across symbols, timeframes, and specified segments, with test EAs to check data acquisition. Its stated purpose is research into price behavior and symbol selection, with later strategy work planned. It supplies implementation detail but no comparative backtest or evidence that ZigZag signals are profitable; turning points and thresholds remain dependent on design choices.

Key ideas

  • The modified ZigZag uses bid highs and ask lows to reflect spread in its swing construction.
  • A minimum impulse threshold determines when a reversal is large enough to form an opposing segment.
  • The indicator can display recent swing segments as well as the broader set of detected extremes.
  • A companion class and test EAs organize ZigZag data retrieval across multiple timeframes and segments.
  • The described tools support price-behavior research but do not establish a profitable trading strategy.

Tags

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