PROTECTED SOURCE SCRIPT
Dynamic Hazard Supertrend Forecast

XAUUSD — Dynamic Hazard Supertrend Forecast (DHF)
Original Indicator by: TheWannaBeQuant

What this indicator does:
It converts price action into 3 clean market states (UP / CHOP / DOWN) and then estimates the probability of where the next H bars will likely “land” using a dynamic hazard (survival) model.
1) How to read it:
A) The line on price (3-state Supertrend):
• GREEN = Uptrend (trend-follow bias)
• YELLOW = Chop / Range (avoid trend trades)
• RED = Downtrend (trend-follow bias)
B) The dashboard (right side):
• MODE = current state (UPTREND / CHOP / DOWNTREND)
• ACTION = TRADE in trends, WAIT in chop
• BIAS = bullish/bearish/neutral
• OUTLOOK = probabilities for the next H bars: UP / CHOP / DOWN
Important: “UP %” does NOT mean “price must go up immediately.”
It means: based on the current state + features, the model believes the next H bars are most likely to remain/resolve into the UP state.
I also want to add that the probability that is given by the indicator is always biased towards the trend and not the general close of the next bar. After extensive back testing, if a probability of >80% appears, it is a sign that could be trust worthy (again, nothing in the world guarantees it will go that way. It is merely math attempting to forecast the future but there is never any guarantee, especially in very small timeframes, that the math can capture all of the noisy signals and make it into an ultimate signal).
2) Why CHOP is special
Most “trend” indicators only flip up/down.
This script creates a CHOP regime by combining:
• Volume slowdown (kernel-weighted statistics, not a basic moving average)
AND
• “First Support/Resistance after a Supertrend flip” gets respected
Meaning: after the first trend break, if price starts respecting the first range boundaries AND momentum/volume fades, the model marks CHOP.
I will constantly updating any issues as I truly believe identifying market regimes is what makes or breaks trading strategies. Your feedback will always be useful in helping me achieve more accuracy in capturing market CHOP

3) Trend examples
When the line is GREEN/RED, you’re in trend mode. CHOP logic is OFF unless range acceptance + slowdown confirms.

I will always remind you to ignore the probability listed by the math unless it hits >80%, which can then help you analyze your own signals alongside this indicators signal to help you take an informed decision
4) Forecasting (DHF) — why probabilities change every bar
The forecast updates every bar close using:
• A time-varying “hazard” (exit probability) that changes with live features:
- How close price is to the Supertrend line
- Volume slowdown intensity (kernel z-score)
- Range evidence (support/resistance touches)
So the forecast is not “stuck” until state changes — it adapts every bar.


In the settings, I encoded an "exit probability" that would allow you to see what the models calculations are when thinking about reversing. I believe that is the true probability that you may want to constantly monitor.
How you would use it: The higher that probability is, the more likely you will experience a reversal in the trend very soon.
5) Settings (recommended starting point)
• Best initial use: XAUUSD, 5m (works on others, but tuned for 5m)
• If CHOP is too rare → loosen range buffer or slowdown threshold
• If CHOP is too frequent → tighten buffer or require stronger slowdown
Truth be told, I am new to this and did not know how to take images of the settings to post it.
I played with the settings and left it at what I think is the optimal settings for the indicator.
I strongly suggest you take some time and also play with the settings as your trading style may be different than my trading style.
Non-repainting notes in full honesty:
• Supertrend uses current close → stable on bar close.
• Pivot-based S/R needs confirmation (by definition). That means CHOP confirmation will have some delay — this is intentional for reliability.
• Volume inputs depend on broker feed (tick/real volume differences).
Disclaimer: THIS INDICATOR IS DESIGNED TO INFORM AND HELP YOU GIVE YOURSELF AN EDUCATED DECISION TO TRADE AND IS NOT FINANCIAL ADVICE.
I also will hide the source code as it took me time to come up with this math and find a way to implement it on TradingView's Pine script.
Original Indicator by: TheWannaBeQuant
What this indicator does:
It converts price action into 3 clean market states (UP / CHOP / DOWN) and then estimates the probability of where the next H bars will likely “land” using a dynamic hazard (survival) model.
1) How to read it:
A) The line on price (3-state Supertrend):
• GREEN = Uptrend (trend-follow bias)
• YELLOW = Chop / Range (avoid trend trades)
• RED = Downtrend (trend-follow bias)
B) The dashboard (right side):
• MODE = current state (UPTREND / CHOP / DOWNTREND)
• ACTION = TRADE in trends, WAIT in chop
• BIAS = bullish/bearish/neutral
• OUTLOOK = probabilities for the next H bars: UP / CHOP / DOWN
Important: “UP %” does NOT mean “price must go up immediately.”
It means: based on the current state + features, the model believes the next H bars are most likely to remain/resolve into the UP state.
I also want to add that the probability that is given by the indicator is always biased towards the trend and not the general close of the next bar. After extensive back testing, if a probability of >80% appears, it is a sign that could be trust worthy (again, nothing in the world guarantees it will go that way. It is merely math attempting to forecast the future but there is never any guarantee, especially in very small timeframes, that the math can capture all of the noisy signals and make it into an ultimate signal).
2) Why CHOP is special
Most “trend” indicators only flip up/down.
This script creates a CHOP regime by combining:
• Volume slowdown (kernel-weighted statistics, not a basic moving average)
AND
• “First Support/Resistance after a Supertrend flip” gets respected
Meaning: after the first trend break, if price starts respecting the first range boundaries AND momentum/volume fades, the model marks CHOP.
I will constantly updating any issues as I truly believe identifying market regimes is what makes or breaks trading strategies. Your feedback will always be useful in helping me achieve more accuracy in capturing market CHOP
3) Trend examples
When the line is GREEN/RED, you’re in trend mode. CHOP logic is OFF unless range acceptance + slowdown confirms.
I will always remind you to ignore the probability listed by the math unless it hits >80%, which can then help you analyze your own signals alongside this indicators signal to help you take an informed decision
4) Forecasting (DHF) — why probabilities change every bar
The forecast updates every bar close using:
• A time-varying “hazard” (exit probability) that changes with live features:
- How close price is to the Supertrend line
- Volume slowdown intensity (kernel z-score)
- Range evidence (support/resistance touches)
So the forecast is not “stuck” until state changes — it adapts every bar.
In the settings, I encoded an "exit probability" that would allow you to see what the models calculations are when thinking about reversing. I believe that is the true probability that you may want to constantly monitor.
How you would use it: The higher that probability is, the more likely you will experience a reversal in the trend very soon.
5) Settings (recommended starting point)
• Best initial use: XAUUSD, 5m (works on others, but tuned for 5m)
• If CHOP is too rare → loosen range buffer or slowdown threshold
• If CHOP is too frequent → tighten buffer or require stronger slowdown
Truth be told, I am new to this and did not know how to take images of the settings to post it.
I played with the settings and left it at what I think is the optimal settings for the indicator.
I strongly suggest you take some time and also play with the settings as your trading style may be different than my trading style.
Non-repainting notes in full honesty:
• Supertrend uses current close → stable on bar close.
• Pivot-based S/R needs confirmation (by definition). That means CHOP confirmation will have some delay — this is intentional for reliability.
• Volume inputs depend on broker feed (tick/real volume differences).
Disclaimer: THIS INDICATOR IS DESIGNED TO INFORM AND HELP YOU GIVE YOURSELF AN EDUCATED DECISION TO TRADE AND IS NOT FINANCIAL ADVICE.
I also will hide the source code as it took me time to come up with this math and find a way to implement it on TradingView's Pine script.
Skrypt chroniony
Ten skrypt został opublikowany jako zamknięty kod źródłowy. Można z tego korzystać swobodnie i bez żadnych ograniczeń — więcej informacji znajduje się tutaj.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt chroniony
Ten skrypt został opublikowany jako zamknięty kod źródłowy. Można z tego korzystać swobodnie i bez żadnych ograniczeń — więcej informacji znajduje się tutaj.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.