OPEN-SOURCE SCRIPT

Enhanced Bollinger Bands [Regime + %B Decay]

223
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.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.