OPEN-SOURCE SCRIPT
Mitigation Block Sentinel [forexobroker]

Mitigation Block Sentinel [forexobroker] locates mitigation blocks: a bullish block is the last down-close candle before an up-displacement that breaks recent structure, the zone where trapped longs were mitigated and from which price tends to launch again (mirror for bearish). The block arms a directional bias, and entries time off an EMA reclaim inside that bias or a strict block retest in Retest-Only mode. A live dashboard tracks both block zones and the current bias.
🔶 ALGORITHM
1. Compute ATR and the prior N-bar structural high and low (structure lookback).
2. A bullish impulse = up candle whose body >= k x ATR that closes above the prior structural high; bearish is the mirror below the prior structural low.
3. Mitigation-block origin scan: from the impulse, scan back up to the block-scan-back limit for the nearest opposite-close candle; its high/low becomes the block top/bottom.
4. The fresh block is armed; a retest occurs when price trades back into the block extended by a retest buffer of k x ATR.
5. A fresh block arms a persistent directional bias that holds until the opposite block forms.
6. Entry timing: an EMA reclaim (close crossing the entry-reclaim EMA in the block direction), or a strict block retest in Retest-Only Mode.
🔶 SIGNAL LOGIC
- Buy: bias == bullish AND close crosses over the reclaim EMA (or a bullish block retest in Retest-Only Mode), in session, with no active long, cooldown elapsed, and barstate.isconfirmed; position locks long.
- Sell: bias == bearish AND close crosses under the reclaim EMA (or a bearish block retest in Retest-Only Mode), in session, with no active short, cooldown elapsed, and barstate.isconfirmed; position locks short.
Only fires while the persistent block bias agrees with the entry direction.
🔶 INPUTS
- Block group: structure lookback for the high/low the impulse must break (default 10).
- Block group: impulse body multiple of ATR for the launch candle (default 1.0).
- Block group: block scan-back bars to find the origin candle (default 6).
- Block group: retest buffer multiple of ATR (default 0.10) and ATR length (default 14).
- Signal Logic group: entry reclaim EMA length (default 9).
- Signal Logic group: Retest-Only Mode toggle (default off) and cooldown bars (default 5).
- Filters group: restrict-to-session toggle and session window (default 0000-2400).
- Visual group: show block zones, dashboard, and 3-layer glow (all default on).
- Visual group: buy color, sell color, and dashboard background.
🔶 ALERTS
MBS Buy, MBS Sell, MBS Any Signal, MBS Bull Block, MBS Bear Block, MBS Bull Retest, MBS Bear Retest, MBS Any Block, MBS EMA Up, MBS EMA Down, MBS Bias Bull, MBS Bias Bear, MBS Webhook JSON.
🔶 LIMITATIONS
- Needs warm-up bars for ATR and the structural lookback before blocks can form.
- The origin scan only reaches back the block-scan-back limit; a block whose origin sits beyond that window is missed.
- ATR-adaptive defaults are tuned for liquid instruments; thin symbols may need the impulse body multiple retuned.
- The persistent bias holds until an opposite block forms, so it can remain stale through extended ranges.
- Signals confirm on bar close; block zones are redrawn on each new block and are not guaranteed support or resistance.
🔶 ALGORITHM
1. Compute ATR and the prior N-bar structural high and low (structure lookback).
2. A bullish impulse = up candle whose body >= k x ATR that closes above the prior structural high; bearish is the mirror below the prior structural low.
3. Mitigation-block origin scan: from the impulse, scan back up to the block-scan-back limit for the nearest opposite-close candle; its high/low becomes the block top/bottom.
4. The fresh block is armed; a retest occurs when price trades back into the block extended by a retest buffer of k x ATR.
5. A fresh block arms a persistent directional bias that holds until the opposite block forms.
6. Entry timing: an EMA reclaim (close crossing the entry-reclaim EMA in the block direction), or a strict block retest in Retest-Only Mode.
🔶 SIGNAL LOGIC
- Buy: bias == bullish AND close crosses over the reclaim EMA (or a bullish block retest in Retest-Only Mode), in session, with no active long, cooldown elapsed, and barstate.isconfirmed; position locks long.
- Sell: bias == bearish AND close crosses under the reclaim EMA (or a bearish block retest in Retest-Only Mode), in session, with no active short, cooldown elapsed, and barstate.isconfirmed; position locks short.
Only fires while the persistent block bias agrees with the entry direction.
🔶 INPUTS
- Block group: structure lookback for the high/low the impulse must break (default 10).
- Block group: impulse body multiple of ATR for the launch candle (default 1.0).
- Block group: block scan-back bars to find the origin candle (default 6).
- Block group: retest buffer multiple of ATR (default 0.10) and ATR length (default 14).
- Signal Logic group: entry reclaim EMA length (default 9).
- Signal Logic group: Retest-Only Mode toggle (default off) and cooldown bars (default 5).
- Filters group: restrict-to-session toggle and session window (default 0000-2400).
- Visual group: show block zones, dashboard, and 3-layer glow (all default on).
- Visual group: buy color, sell color, and dashboard background.
🔶 ALERTS
MBS Buy, MBS Sell, MBS Any Signal, MBS Bull Block, MBS Bear Block, MBS Bull Retest, MBS Bear Retest, MBS Any Block, MBS EMA Up, MBS EMA Down, MBS Bias Bull, MBS Bias Bear, MBS Webhook JSON.
🔶 LIMITATIONS
- Needs warm-up bars for ATR and the structural lookback before blocks can form.
- The origin scan only reaches back the block-scan-back limit; a block whose origin sits beyond that window is missed.
- ATR-adaptive defaults are tuned for liquid instruments; thin symbols may need the impulse body multiple retuned.
- The persistent bias holds until an opposite block forms, so it can remain stale through extended ranges.
- Signals confirm on bar close; block zones are redrawn on each new block and are not guaranteed support or resistance.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.