OPEN-SOURCE SCRIPT
Enhanced Bollinger Bands [Regime + %B Decay]

A modular rewrite of classic Bollinger Bands. Most BB indicators just plot bands; this one treats them as a system with four moving parts.
Adaptive basis. Pick SMA, EMA, HMA, KAMA (with tunable fast/slow SC), or VWMA. HMA tracks trend with low lag; KAMA adapts to noise; VWMA weights by volume.
Asymmetric bands (optional). Instead of one σ for both sides, upper/lower bands can use upside/downside semi-deviation (√2-normalized so magnitudes stay comparable to symmetric σ). Useful for markets with persistent skew. A floor at 50% of symmetric σ prevents the semi-dev from collapsing to zero in one-sided trends — a known failure mode of naive semi-dev bands.
Regime classification. Every bar is tagged SQUEEZE / WALK_UP / WALK_DOWN / RANGE. Squeeze detection supports TTM-style nesting (BB inside Keltner), bandwidth percentile (current BW vs. its own history — recommended ≥500 bars on crypto 1H), or both. The regime drives the background color so you can read the state at a glance.
%B Decay — the reversal trigger. During an active band walk, the script tracks each new price extreme and the %B at that bar. If price keeps making new highs but %B at those highs is decreasing, the penetration depth is fading: price is still grinding higher, but its relative extreme vs. the volatility-adaptive band is shrinking. After N consecutive decays (default 2, configurable), an orange triangle prints. Conceptually this is a price-vs-adaptive-threshold divergence, scoped to where it matters — inside an active walk, not on every bar. Cleaner than RSI divergence because the threshold itself adapts to volatility.
Adaptive basis. Pick SMA, EMA, HMA, KAMA (with tunable fast/slow SC), or VWMA. HMA tracks trend with low lag; KAMA adapts to noise; VWMA weights by volume.
Asymmetric bands (optional). Instead of one σ for both sides, upper/lower bands can use upside/downside semi-deviation (√2-normalized so magnitudes stay comparable to symmetric σ). Useful for markets with persistent skew. A floor at 50% of symmetric σ prevents the semi-dev from collapsing to zero in one-sided trends — a known failure mode of naive semi-dev bands.
Regime classification. Every bar is tagged SQUEEZE / WALK_UP / WALK_DOWN / RANGE. Squeeze detection supports TTM-style nesting (BB inside Keltner), bandwidth percentile (current BW vs. its own history — recommended ≥500 bars on crypto 1H), or both. The regime drives the background color so you can read the state at a glance.
%B Decay — the reversal trigger. During an active band walk, the script tracks each new price extreme and the %B at that bar. If price keeps making new highs but %B at those highs is decreasing, the penetration depth is fading: price is still grinding higher, but its relative extreme vs. the volatility-adaptive band is shrinking. After N consecutive decays (default 2, configurable), an orange triangle prints. Conceptually this is a price-vs-adaptive-threshold divergence, scoped to where it matters — inside an active walk, not on every bar. Cleaner than RSI divergence because the threshold itself adapts to volatility.
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.
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.