OPEN-SOURCE SCRIPT
Zaktualizowano Dynamic Volatility Bull/Bear Threshold

Overview
This indicator builds on Anton Kreil's (POTM) "drawdown-from-high" bull/bear framework and upgrades it into a volatility-adaptive version. It anchors to the rolling high (HH) and derives a dynamic bear level from annualized volatility (σ) and a multiple N: a close below it signals bear; reclaiming it while above the long-term MA signals bull.
Core logic
Rolling High HH: the highest high over the past lookback (default 252) bars — the anchor for every level.
Dynamic Bear Level: HH × (1 − N×σ). The drawdown threshold tightens when volatility is low and loosens when it is high (clamped to 5%~60%), so high-vol instruments never end up with a useless "dead line."
Fixed 20% Line: HH × 0.8, i.e. 20% below the high — the original course definition of a bear market, shown for comparison.
Confirm MA: the maLen (default 200) SMA of close, used to confirm trend recovery.
Signals & colors
🔻 Red triangle: close just broke below the dynamic bear level → Bear (Dynamic)
🟠 Orange circle: close just broke 20% below the rolling high → 20% Line Alert (course bear early-warning)
🟢 Green triangle: close reclaimed the dynamic level and crossed above the confirm MA → Bull Confirm
Background: Red = Bear, Green = Bull, Yellow = Recovering
Inputs
Lookback (default 252): window for σ and the rolling high
Vol multiple N (default 1.2): larger N = deeper bear threshold; 0.81.0 more sensitive, 1.82.0 only on crashes
Bull-confirm MA period (default 200)
Overlay fixed 20% line / Show confirm MA: toggles
How to use
Watch the red dynamic bear line as the primary signal; for the strict course rule "20% below high = bear," watch the orange circle. The yellow "Recovering" zone is often a good watch area for option positioning. This is a trend state machine, not a short-term entry signal.
Disclaimer
For research and education only. Not investment advice. Past performance does not guarantee future results.
This indicator builds on Anton Kreil's (POTM) "drawdown-from-high" bull/bear framework and upgrades it into a volatility-adaptive version. It anchors to the rolling high (HH) and derives a dynamic bear level from annualized volatility (σ) and a multiple N: a close below it signals bear; reclaiming it while above the long-term MA signals bull.
Core logic
Rolling High HH: the highest high over the past lookback (default 252) bars — the anchor for every level.
Dynamic Bear Level: HH × (1 − N×σ). The drawdown threshold tightens when volatility is low and loosens when it is high (clamped to 5%~60%), so high-vol instruments never end up with a useless "dead line."
Fixed 20% Line: HH × 0.8, i.e. 20% below the high — the original course definition of a bear market, shown for comparison.
Confirm MA: the maLen (default 200) SMA of close, used to confirm trend recovery.
Signals & colors
🔻 Red triangle: close just broke below the dynamic bear level → Bear (Dynamic)
🟠 Orange circle: close just broke 20% below the rolling high → 20% Line Alert (course bear early-warning)
🟢 Green triangle: close reclaimed the dynamic level and crossed above the confirm MA → Bull Confirm
Background: Red = Bear, Green = Bull, Yellow = Recovering
Inputs
Lookback (default 252): window for σ and the rolling high
Vol multiple N (default 1.2): larger N = deeper bear threshold; 0.81.0 more sensitive, 1.82.0 only on crashes
Bull-confirm MA period (default 200)
Overlay fixed 20% line / Show confirm MA: toggles
How to use
Watch the red dynamic bear line as the primary signal; for the strict course rule "20% below high = bear," watch the orange circle. The yellow "Recovering" zone is often a good watch area for option positioning. This is a trend state machine, not a short-term entry signal.
Disclaimer
For research and education only. Not investment advice. Past performance does not guarantee future results.
Informacje o Wersji
bug fixedSkrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
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 open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
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.