Swing High/Low Indicators: How Do You Balance Real-Time Detection and Repainting?

While developing a swing high/low indicator, one challenge I have encountered is getting newly detected swing points to appear quickly enough for real-time analysis.

The difficulty is that identifying a potential swing and confirming that it is an actual swing are two different things.

In my experience, the indicator sometimes takes additional bars or price movement before updating the chart with a newly detected swing point. Although this helps avoid marking temporary highs and lows as confirmed swings, it also makes the indicator less responsive when monitoring price movements in real time.

On the other hand, attempting to display swing points earlier introduces another challenge: the identified point may need to be moved or removed as price continues to develop.

I'm interested in how other MQL5 developers approach this problem.

A few questions:

  1. Do you allow your indicator to display provisional swing points before they are fully confirmed?

  2. How do you manage the transition from a provisional swing to a confirmed swing without unnecessarily recalculating the entire indicator?

  3. What approaches have you found effective for updating swing points in real time while keeping historical signals consistent?

  4. Would separating provisional and confirmed swing points into different indicator buffers be a practical approach?

  5. How do you balance detection speed against the risk of repainting?

I'd particularly appreciate insights from developers who have implemented custom ZigZag, pivot or market structure indicators.

I would be interested to learn how others handle this trade-off in their implementations.

Dora Nafwa Mwabini:
I'd particularly appreciate insights from developers who have implemented custom ZigZag..
You need get with Connor McNamara about that. Dude's got more custom ZigZags in the CodeBase than my neighbors got teeth.