Indicators: Market Structure BOS and CHoCH - swing points HH / HL / LH / LL, no repaint, alerts

Market Structure BOS and CHoCH - swing points HH / HL / LH / LL, no repaint, alerts:

Market structure in the way of Smart Money Concepts: swing highs and lows with HH / HL / LH / LL labels, BOS (break of structure) and CHoCH (change of character) lines. Swings count only after their right candles close, so nothing repaints. Alerts and a trend buffer for EAs.

Market Structure BOS and CHoCH - swing points HH / HL / LH / LL, no repaint, alerts

Author: Muhammad Muqeem Korejo

Clean closed-bar discipline and the self-audit is a nice touch. The mitigation state machine is well separated from presentation. Would be useful to see a small example of the audit output format.

Thank you for the kind words! One correction so nobody is confused: this indicator has no separate audit output or mitigation logic. It marks the swings (HH / HL / LH / LL), BOS and CHoCH, and everything is decided on closed candles only.

To check it from your own code, read the buffers: 0 = trend (+1 up, -1 down, 0 none yet), 1 = last swing high, 2 = last swing low. Example: double trend[]; CopyBuffer(handle, 0, 1, 1, trend); gives the trend on the last closed candle.