Join our fan page
- Views:
- 2600
- Rating:
- Published:
- 2025.03.31 21:12
- Updated:
- 2025.04.07 13:40
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
This indicator differs from the traditional zigzag you're already familiar with. The traditional zigzag serves a different purpose: it primarily highlights previous market swings and delays by the necessary number of bars before confirming the next swing. It works based on price action. A lagging and repainting indicator is not intended to detect real-time signals. The zigzag drawing is less commonly used in trend-following indicators. It is more commonly used to analyze historical pivot points in a market to predict future price movements.
This zigzag is something else entirely. It's a dynamic, trend-based zigzag with no lag up to the current bar. I base it on the SAR trend, which is a trend-following algorithm with no lag. Trend-following zigzags have been developed in the past, including one based on the PSAR, but they were delayed and produced invalid legs. Why have a lagging zigzag based on a non-lagging trend-following algorithm? This didn't seem logical to me. That's why I created this, because I think we should have a zero lag zigzag drawing.
A backstep is used to keep the legs valid. When searching for a high, it will find the highest high from the number of lookback bars defined in the backstep input, and will find the lowest low when searching for a low by the same number of lookback bars defined by the backstep figure. This means that the end of the segment will sometimes swing at the high or low, or at most recent support or resistance.The PSAR is known to struggle in ranging markets, and this is a shortcoming of it. Otherwise, it's quite a decent trend-following indicator. This zigzag structure is the most relevant part of the code. It was designed to be clean, efficient, and maintainable. I hope you appreciate the work and experimentation.

This MT5 Expert Advisor combines multi-timeframe candlestick pattern analysis with fundamental event filtering to execute trades with disciplined risk management.

An indicator which attempts to highlight a ranging market area

Tester's single pass data.

Calendar - fundamental analysis on history and real-time.