PROTECTED SOURCE SCRIPT
MSS Boxes (close-break only)

What it does
MSS Boxes detects Market Structure Shifts (MSS) and draws clean, non-repainting mitigation boxes you can trade from. When price closes through the most recent swing with momentum, the candle that caused the break is captured as a box (supply for bearish, demand for bullish) and extended to the right as objective S/R.
How it works
Swings: swing highs/lows from your chosen left/right bars.
Shift: a bullish shift when price closes above the last swing high; bearish when it closes below the last swing low.
Displacement filter: optional size/ATR filter to require an impulsive break.
Box recipe: use wick-to-wick or body-only from the last opposite-colour candle before the break. Boxes don’t move after confirmation.
Lifecycle
Active → printed and valid.
Mitigated → price trades back into the box (optional strict wick rule).
Invalidated → close through the far side.
Expired → after N bars or at your session reset (e.g., NY 18:00).
What you see
Green boxes for bullish, red for bearish.
Small tag at origin (e.g., BOS↑/BOS↓).
Optional status markers (active/mitigated/invalid).
Key options
Swing length and displacement thresholds.
Box style (wicks vs body), max height cap, auto-merge overlaps.
MTF alignment (H1/M15) for plotting or alerts only.
Session reset time, max boxes, colours/opacity/label size.
MSS Boxes detects Market Structure Shifts (MSS) and draws clean, non-repainting mitigation boxes you can trade from. When price closes through the most recent swing with momentum, the candle that caused the break is captured as a box (supply for bearish, demand for bullish) and extended to the right as objective S/R.
How it works
Swings: swing highs/lows from your chosen left/right bars.
Shift: a bullish shift when price closes above the last swing high; bearish when it closes below the last swing low.
Displacement filter: optional size/ATR filter to require an impulsive break.
Box recipe: use wick-to-wick or body-only from the last opposite-colour candle before the break. Boxes don’t move after confirmation.
Lifecycle
Active → printed and valid.
Mitigated → price trades back into the box (optional strict wick rule).
Invalidated → close through the far side.
Expired → after N bars or at your session reset (e.g., NY 18:00).
What you see
Green boxes for bullish, red for bearish.
Small tag at origin (e.g., BOS↑/BOS↓).
Optional status markers (active/mitigated/invalid).
Key options
Swing length and displacement thresholds.
Box style (wicks vs body), max height cap, auto-merge overlaps.
MTF alignment (H1/M15) for plotting or alerts only.
Session reset time, max boxes, colours/opacity/label size.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.