A 20-period SMA wrapped in standard-deviation envelopes (default ±2σ). The most widely-used volatility indicator in retail trading — defines what "stretched" means statistically and provides one of the cleanest mean-reversion signals available.
Bollinger Bands(20, 2) on MES 5m — squeeze and breakout
What it measures
- Volatility envelope. The bands expand and contract with price volatility. Wide bands = high volatility; narrow ("squeezed") bands = low volatility.
- Statistical extremes. ~95% of price action stays within ±2σ bands. Touches of the upper or lower band are statistically unusual readings.
- Mean reversion reference. The middle band (the SMA) is the magnet — price tends to revert toward it after stretching.
Formula
How AlgoLift computes it
Middle Band = SMA(price, period)
σ = standard deviation of price over the same period
Upper Band = Middle + multiplier × σ
Lower Band = Middle − multiplier × σ
The bands are symmetric around the SMA. When volatility spikes, σ increases and the bands widen. When volatility contracts, σ decreases and the bands narrow — the famous "squeeze" that often precedes a breakout.
AlgoLift also computes:
- %B (percent_b):
(Close − Lower) / (Upper − Lower) × 100— where price sits within the channel (0 = lower band, 50 = middle, 100 = upper, > 100 or < 0 = outside the bands). - Width:
Upper − Lower— absolute band width, useful for squeeze detection. - Deviation:
Close − Middle— raw distance from the SMA.
Developed by John Bollinger in the 1980s.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 20 | 2–500 | Lookback for the SMA and standard deviation. |
| StdDev Multiplier | 2.0 | 0.1–5.0 | Number of standard deviations away from the middle. 2.0 covers ~95% of price action under a normal distribution. |
Recommended settings
- (20, 2.0) — default: Bollinger's original. Works across timeframes.
- (20, 2.5): Wider bands — fewer touches, higher conviction when they occur.
- (10, 1.5): Tighter and faster — for short-timeframe scalping.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Upper Band | Numeric | Always | The +2σ envelope. Dynamic resistance reference. |
| Middle Band (SMA) | Numeric | Always | The central SMA. The "magnet" price reverts toward. |
| Lower Band | Numeric | Always | The −2σ envelope. Dynamic support reference. |
| Channel Width | Numeric | On select | Upper − Lower. Low width = squeeze; high width = expansion. |
| %B (Position) | Numeric | On select | Position within the channel (0-100, outside the bands when > 100 or < 0). |
| Deviation | Numeric | On select | Absolute distance from middle. |
| Slope (Middle) | Numeric | On select | Rate of change of the SMA — mid-term trend direction. |
Bollinger Bands node — default state with all seven outputs
Reading the components together
The three primary lines + %B give you a complete picture:
- Price near upper band (%B > 80): Stretched up — possibly overbought in a range, possibly the start of a breakout in a trend.
- Price near lower band (%B < 20): Stretched down — possibly oversold in a range, possibly a breakdown in a trend.
- Price outside the bands (%B > 100 or < 0): Genuinely extreme, statistically rare.
- Bands wide and parallel: Trending market.
- Bands narrow and converging: Squeeze — pent-up volatility, often precedes a breakout.
- Price riding the upper band in a strong uptrend: Normal, not an overbought sell signal.
Bollinger Bands don't tell you to trade extremes — they tell you what "extreme" means right now, given the current volatility. The same touch of the upper band means different things in a range (likely reversal) vs. a trend (continuation). Always read the bands alongside trend context.
Best in / worst in
Best in range-bound markets, on instruments with mean-reverting tendencies, and as a volatility-aware reference for any strategy that needs "stretched" thresholds. Excellent companion to oscillators.
Worst in strong sustained trends where price rides one band continuously, treating that as overbought/oversold loses money systematically. Also weak on instruments with persistent volatility shocks (some crypto pairs) where σ spikes mean less.
Three setups
1. Mean reversion at the bands
The textbook setup — fade extreme touches in range-bound conditions.
- Long: Price closes below Lower Band AND KAMA Efficiency Ratio < 0.3 (range regime) AND RSI < 30.
- Short: Price closes above Upper Band AND ER < 0.3 AND RSI > 70.
The regime filter is essential — without it, this setup will fade real trends and bleed continuously. The RSI confirmation adds an independent oversold/overbought check.
Bollinger mean-reversion with regime + RSI confirmation
2. Squeeze breakout
Trade the directional breakout out of a squeeze.
- Long: Channel Width was below its 50-bar average (squeeze) for at least 10 bars AND price closes above Upper Band.
- Short: Same squeeze condition AND price closes below Lower Band.
The wait-for-the-actual-breakout requirement filters out fakeout squeezes that fail to release.
3. Bollinger %B as a regime gate
Use %B's position to define market state for other strategies.
- Trend confirmation mode: Price stays at %B > 90 or %B < 10 for many bars = trending regime, trend strategies favored.
- Mean-reversion mode: %B oscillates between 30 and 70 = range regime, mean-reversion strategies favored.
Use a Tally node to count consecutive bars in each zone.
Advanced patterns in AlgoLift
Squeeze detection via Channel Width derivative. Apply ROC Modifier to the Channel Width output to see how quickly the bands are contracting. A strong negative ROC means an active squeeze in progress — set a flag via Set User Variable and enter on the first breakout that follows.
%B for scaled entries. Take initial entry at %B = 5 (near lower band) on a mean-reversion long. Use Scaled Entry to add at %B = 50 (price has reverted halfway) — confirms the reversion is happening, adds to a winning position.
Asymmetric Bollinger with separate_multipliers (Keltner option). Note: this is a Keltner Channel feature, not Bollinger. For Bollinger-like asymmetry, use two separate Bollinger nodes with different multipliers and combine their bands.
Bollinger + ATR sanity check. If Bollinger's Channel Width and ATR disagree on whether volatility is high or low, something unusual is happening (e.g., σ-based bands haven't caught up to a recent volatility burst). Use the comparison as a "non-standard regime" warning.
Common mistakes
- Trading every band touch. In trends, price rides the band — every touch becomes a buy-the-top or sell-the-bottom failure. Always filter by regime first.
- Treating %B > 100 / %B < 0 as immediate reversal signals. Price can stay outside the bands for many bars in strong directional moves. The extreme reading is information, not a trigger.
- Optimizing the multiplier. The 2.0 default is statistically motivated (~95% coverage under normal distribution). Tuning it usually means fitting noise — the math behind the default is real.
- Confusing Bollinger with Keltner. Both are envelope indicators but Bollinger uses standard deviation around an SMA; Keltner uses ATR around an EMA. The two often disagree, and that disagreement is itself informative.