Skip to content
All library documents

ZigZag Peak Detection with Confirmation Bars and Price Levels

Article MQL5 articles

Summary

The article explains ZigZag as a compact representation of alternating price peaks and troughs, then describes a method for detecting those turning points. A candidate peak is identified by comparing a sequence of bars with lower highs around its maximum; the inverse pattern defines a trough. The ExtDepth and CheckBar settings control the search and how many later bars must confirm an extremum. With confirmation bars, a new ZigZag segment is delayed but the latest segment is less prone to continual redrawing than in a standard implementation.

The indicator can use different bar price fields, consult a smaller timeframe when both extremes occur within one bar, display levels where a new extremum may form, record turning points, and add Fibonacci levels to recent segments. The article presents these as analysis aids and potential inputs to strategy design. It also acknowledges that ZigZag values can change as prices develop; even confirmed points are described as potential reversals, not guaranteed forecasts. No trading performance tests are provided.

Key ideas

  • ZigZag represents price history as alternating peaks and troughs rather than displaying every bar movement.
  • Peak and trough candidates are detected from neighboring bars, with ExtDepth and CheckBar controlling the pattern and confirmation.
  • Requiring later bars to confirm an extremum reduces frequent updates but delays the new segment.
  • The indicator can use different price fields, inspect a lower timeframe, record points, and draw levels or Fibonacci guides.
  • ZigZag turning points are analysis signals with redraw and forecasting limitations, not guaranteed reversals.

Tags

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