OPEN-SOURCE SCRIPT
Actualizado 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.
Notas de prensa
bug fixedScript de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.