OPEN-SOURCE SCRIPT
MAD Z Robust Burst [forexobroker]

MAD Z Robust Burst computes a Median Absolute Deviation z-score: MAD-Z = (close - median) / (1.4826 * MAD), where MAD = median(|x - median|). The 1.4826 factor makes MAD a consistent estimator of stdev under normality. Robust to outliers — a single price spike does not inflate the divisor like ordinary stdev does. Visual signature: outlined-only square markers (no fill), MAD bands.
🔶 ALGORITHM
1. window = last N closes.
2. med = median(window).
3. abs_dev[k] = |close[k] - med|.
4. MAD = median(abs_dev).
5. MAD-Z = (close - med) / (1.4826 * MAD).
6. Burst regime when |MAD-Z| > threshold.
7. Return-from-burst entry: signal fires when MAD-Z comes back below the return threshold from a burst.
🔶 SIGNAL LOGIC
- Buy: prior burst-down AND MAD-Z >= -return-threshold AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: prior burst-up AND MAD-Z <= +return-threshold.
- Position-lock state machine.
🔶 INPUTS
- MAD Window (default 40)
- Burst Z entry start (default 2.0)
- Return Z entry fire (default 1.0)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, MAD bands, outlined markers, buy / sell colors
🔶 ALERTS
MZB Buy, MZB Sell, MZB Any Signal, MZB Burst Up, MZB Burst Down, MZB Extreme, MZB Return Up, MZB Return Down, MZB Webhook JSON.
🔶 LIMITATIONS
- MAD is robust but slower-reacting than stdev; bursts may persist a bit longer before being detected.
- The 1.4826 normalisation assumes Gaussian-like distributions; for heavy-tailed assets the conversion is approximate.
- Outlined squares (no glow stack) is a deliberate visual choice — the indicator looks unique but has slightly lower visibility than filled markers.
- Return-from-burst entry is mean-reversion oriented; not for breakout players.
🔶 ALGORITHM
1. window = last N closes.
2. med = median(window).
3. abs_dev[k] = |close[k] - med|.
4. MAD = median(abs_dev).
5. MAD-Z = (close - med) / (1.4826 * MAD).
6. Burst regime when |MAD-Z| > threshold.
7. Return-from-burst entry: signal fires when MAD-Z comes back below the return threshold from a burst.
🔶 SIGNAL LOGIC
- Buy: prior burst-down AND MAD-Z >= -return-threshold AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: prior burst-up AND MAD-Z <= +return-threshold.
- Position-lock state machine.
🔶 INPUTS
- MAD Window (default 40)
- Burst Z entry start (default 2.0)
- Return Z entry fire (default 1.0)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, MAD bands, outlined markers, buy / sell colors
🔶 ALERTS
MZB Buy, MZB Sell, MZB Any Signal, MZB Burst Up, MZB Burst Down, MZB Extreme, MZB Return Up, MZB Return Down, MZB Webhook JSON.
🔶 LIMITATIONS
- MAD is robust but slower-reacting than stdev; bursts may persist a bit longer before being detected.
- The 1.4826 normalisation assumes Gaussian-like distributions; for heavy-tailed assets the conversion is approximate.
- Outlined squares (no glow stack) is a deliberate visual choice — the indicator looks unique but has slightly lower visibility than filled markers.
- Return-from-burst entry is mean-reversion oriented; not for breakout players.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🔵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.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🔵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.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.