Systemicbeta

Bollinger Bands

systemic:core-bbIndicators

Inputs

NameTypeDescription
WindowWhole numberThe number of bars used for the moving average and the standard deviation.
Deviation WindowWhole numberThe number of standard deviations between the Middle Band and each outer band.
Price DataNumber seriesThe price series to build the bands around, one value per bar.

Outputs

NameTypeDescription
Upper BandNumber seriesThe Upper Band: the Middle Band plus the chosen number of standard deviations.
Lower BandNumber seriesThe Lower Band: the Middle Band minus the chosen number of standard deviations.
Simple Moving AverageNumber seriesThe Middle Band: the simple moving average (SMA) of the price over the window.
Upper Band IndicatorNumber seriesA 0/1 series: 1 on bars where the price is above the Upper Band, 0 otherwise.
Lower Band IndicatorNumber seriesA 0/1 series: 1 on bars where the price is below the Lower Band, 0 otherwise.

Cost

30
credits per run
1,000
bars

0.215 + 0.029·n credits for n bars, rounded up. The marks are each plan's limit of bars.

A practical guide to Bollinger Bands: spotting volatility regimes and overbought/oversold conditions in traditional and crypto markets.


Overview

Bollinger Bands are a popular technical analysis tool developed by John Bollinger in the 1980s. They consist of three lines plotted on a price chart:

  • Middle Band (the Simple Moving Average output): A simple moving average (SMA) of the price, typically over 20 bars.
  • Upper Band: A set number of standard deviations (typically two) above the Middle Band.
  • Lower Band: The same number of standard deviations below the Middle Band.

The module also returns the Upper Band Indicator and the Lower Band Indicator: 1 on bars where the price is above the Upper Band or below the Lower Band, 0 otherwise.

Why Bollinger Bands matter:

  • Volatility insight: Bands widen and narrow with volatility, helping traders spot regime shifts.
  • Overbought/oversold detection: Price touching or exceeding bands can signal stretched conditions.
  • Breakout and reversal signals: Band squeezes and expansions often precede major moves.
  • Cross-asset utility: Used in stocks, forex, commodities, and crypto.

Quick links:


How It Works

Bollinger Bands use a moving average and a standard deviation to draw a channel around the price. The bands widen when volatility is high and narrow when it is low.

Formulas

Middle Band (MB):

MB=SMAnMB = SMA_n

Where nn is the window in bars (commonly 20).

Upper Band (UB):

UB=MB+(K×σ)UB = MB + (K \times \sigma)

Where KK is the number of standard deviations (commonly 2), and σ\sigma is the population standard deviation of the price over the same nn bars.

Lower Band (LB):

LB=MB−(K×σ)LB = MB - (K \times \sigma)

Calculation Flow

flowchart TD
    Price[Price Series] --> SMA[Calculate SMA]
    Price --> STD[Calculate Standard Deviation]
    SMA --> UB[Upper Band]
    SMA --> LB[Lower Band]
    STD --> UB
    STD --> LB

Interpretation and Use Cases

Typical Ranges

  • Bands: Dynamic, based on volatility. Wider = more volatile, narrower = less volatile.
  • Price vs Bands: Price near upper band = potential overbought; near lower band = potential oversold.

Signal Logic

  • Band Squeeze: Bands contract tightly—volatility is low, a breakout may be imminent.
  • Band Expansion: Bands widen—volatility is high, often after a breakout.
  • Price Touches/Breaks Band: May signal overbought/oversold, but not always a reversal—context matters.
  • Walk the Band: In strong trends, price can ride the upper or lower band for extended periods.

Use Case 1: Stock Mean Reversion

  • Scenario: S&P 500 stock price closes below the lower band after a long uptrend.
  • Interpretation: Potential oversold condition; traders may look for a bounce or reversal.
  • Reference: Fidelity: BB in Stock Trading

Use Case 2: Crypto Volatility Breakout

  • Scenario: Bitcoin's bands squeeze tightly, then price breaks above the upper band on high volume.
  • Interpretation: Volatility expansion; traders may enter momentum trades in the direction of the breakout.
  • Reference: Binance Academy: BB in Crypto

Use Case 3: Trend Confirmation

  • Scenario: Ethereum price rides the upper band for several days.
  • Interpretation: Confirms a strong uptrend; traders may hold or add to positions, not fade the move.

Use Case 4: Volatility Regime Change

  • Scenario: Bands contract to their narrowest in months on a major index.
  • Interpretation: Precursor to a large move; traders prepare for breakout setups.

Decision Flow Example

flowchart TD
    S[New Bar Closes] --> A{Bands Squeezed?}
    A -->|Yes| B[Prepare for Breakout]
    A -->|No| C{Price Touches Upper Band?}
    C -->|Yes| D[Check for Overbought or Trend]
    C -->|No| E{Price Touches Lower Band?}
    E -->|Yes| F[Check for Oversold or Trend]
    E -->|No| G[No Signal]

Comparison: Bollinger Bands vs. Other Volatility Indicators

IndicatorMeasuresOutputBest For
Bollinger BandsStd. dev. of priceDynamic bandsOverbought/oversold, breakouts
Keltner ChannelATR (volatility)BandsTrend following, volatility
ATRTrue range (volatility)Price unitsStop-loss, regime detection
Donchian ChannelPrice highs/lowsBandsBreakouts, trend confirmation
  • Bollinger Bands use standard deviation, making them sensitive to outliers and volatility spikes.
  • Keltner Channels use ATR, so they are smoother and less reactive to price jumps.
  • Donchian Channels focus on price extremes, not volatility.

Practical Example

Suppose you analyze a 20-day window for a stock:

  • 20-day SMA (MB) = $100
  • 20-day standard deviation (σ\sigma) = $5
  • KK = 2

Upper Band:

UB=100+(2×5)=110UB = 100 + (2 \times 5) = 110

Lower Band:

LB=100−(2×5)=90LB = 100 - (2 \times 5) = 90
DayCloseMB (SMA)σUBLB
20102100511090

Band Squeeze and Breakout Visualization

flowchart TD
    P[Band Squeeze Detected] --> Q[Monitor for Breakout]
    Q --> R{Breakout Direction?}
    R -->|Up| S[Enter Long or Momentum Trade]
    R -->|Down| T[Enter Short or Hedge]

Missing Data

A bar with an empty Price Data value (a data gap, weekend or holiday) is empty on all five outputs. It is never filled with zero or with the last band value. The Window counts only bars that have data, not calendar days: the moving average and the standard deviation bridge from the last bar before a gap to the first bar after it. The bands are empty until the window is full; with a window of 20, the first values are on the 20th bar with data. The two indicator outputs follow the same rule: they are empty at a gap and during warm-up, never 0.


Advantages and Limitations

Advantages:

  • Adapts to volatility, providing dynamic support/resistance (Investopedia)
  • Useful for both mean reversion and breakout strategies
  • Works across all asset classes and timeframes

Limitations:

  • Can give false signals in strong trends (Binance Academy)
  • Not predictive—should be combined with other indicators (e.g., RSI, volume)
  • Subjective interpretation; requires experience

References and Further Reading


Glossary

  • Volatility: The degree of variation in price over time
  • Standard Deviation (σ): A measure of how spread out prices are from the average
  • SMA (Simple Moving Average): The average price over a set number of bars
  • Band Squeeze: When the bands contract tightly, indicating low volatility
  • Breakout: A price move outside a defined range, often with increased volatility
  • Mean Reversion: The tendency for price to return to its average

For best results, use Bollinger Bands with other indicators and always test your strategy on historical data first.


Indicator Assessment

---
config:
  xyChart:
    width: 600
    height: 400
  themeVariables:
    xyChart:
      plotColorPalette: "#9b59b6, #f39c12"
---
xychart-beta horizontal
    title "Bollinger Bands Assessment (Scale: 1-10)"
    x-axis ["Popularity", "Reliability", "Complexity", "Versatility", "Recent Interest"]
    y-axis "Score" 0 --> 10
    bar [10, 7, 3, 9, 8]
    bar [9, 6, 3, 9, 9]

Legend: First bar (purple) = Equities/Forex | Second bar (orange) = Cryptocurrency

Dimension Explanations

DimensionEquities/ForexCryptoRationale
Popularity109One of the most widely used technical indicators globally. Standard on all charting platforms. Developed by John Bollinger in the 1980s with dedicated following. Extremely popular in crypto trading communities.
Reliability76Excellent for volatility measurement and mean reversion in range-bound markets. Less reliable in strong trends where price "walks the band." In crypto, false signals more common due to higher volatility.
Complexity33Simple concept: moving average with standard deviation bands. Easy to interpret visually. Requires practice to avoid false signals.
Versatility99Supports multiple trading styles: mean reversion, breakout, trend-following. Works across all timeframes. The squeeze/expansion pattern is universally applicable.
Recent Interest89Continued strong interest in traditional markets. Very popular in crypto for identifying volatility cycles and breakout setups. Featured in countless educational resources and trading systems.
Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5