Bollinger Bands plot a moving average (the middle band) plus and minus a configurable multiple of the rolling standard deviation (the upper and lower bands). The bands automatically widen during volatile periods and tighten during calm ones.
Formula
middle = SMA(close, period)
sd = stddev(close, period)
upper = middle + std_dev * sd
lower = middle - std_dev * sdParams
period- window for the SMA and stddev. Default 20.- std dev - band width multiplier. Default 2.0.
Output
Four columns:
{name}_upper{name}_middle{name}_lower{name}_width-upper - lower(raw price units)
Usage
- Mean reversion: fade touches of the outer bands back toward the middle (often combined with RSI).
- Breakout: enter on close above upper / below lower, expecting the move to continue.
- Squeeze detection: narrow Bollinger width signals compression and often precedes a directional move. Combine with the Volatility Squeeze indicator for a Keltner-aware version.
Pitfalls
- Bollinger is a description of past volatility, not a predictor. Touches outside the bands happen routinely in strong trends.
std_dev = 2is convention, not law. 1.5 produces more touches; 2.5 fewer. Calibrate against your symbol's volatility.
