OPEN-SOURCE SCRIPT

Bollinger Bands with 4 Moving Averages

93
Combines Bollinger Bands (BB) with up to four optional Moving Averages (MA) to read volatility, trend direction, and dynamic support–resistance in one overlay.

How It Works

BB: basis = MA(length, type) with standard deviation mult. upper = basis + dev, lower = basis − dev.

MA1–MA4: additional averages you can toggle (default only MA4/200 enabled).

Key Features

Flexible basis MA type for BB: SMA / EMA / RMA (Wilder) / WMA / VWMA.

Four optional MAs with independent length, color, and width (defaults: 7, 25, 99, 200; only 200 on by default).

Offset to shift BB for visual testing.

Overlay on price with shaded band between Upper–Lower.

Inputs & Defaults

BB Length = 20, StdDev = 2.0, Source = close.

Basis MA Type = SMA.

MA4 active (200), MA1–MA3 off (7/25/99 ready).

Offset = 0.

Practical Use

Use BB for volatility context: squeeze → potential breakout; expansion → strong trend.

Treat Basis / Upper / Lower as dynamic levels:

Pullbacks to Basis often become decision zones in trends.

Upper/Lower touches = relative extremes.

Add MA4(200) for primary bias; enable MA1–MA3 for finer timing.

Typical behavior:

Price > MA200 and rising basis → bullish bias; watch pullbacks to basis/MA25-like zones.

Price < MA200 and falling basis → bearish bias; watch rejections at basis/MAs.

Common Signals (not financial advice)

Breakout + BB expansion confirms momentum.

Squeeze + basis break can preface volatility expansion.

Confluence: Lower touch + fast MA in uptrends → mean-reversion setups; inverse for downtrends.

Notes

MA1–MA4 are SMA in the code; BB basis follows the selected MA type.

Test across timeframes; tune length and mult to the asset.

Disclaimer
Visual tool only. Combine with risk management, multi-timeframe confirmation, and a tested plan.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.