Bollinger Bands Calculator
Compute upper and lower Bollinger Bands from your price data, visualize them on a chart, and inspect detailed signals.
Typical default is 20 periods.
Common setting is 2.0.
For Typical/Weighted, enter data as H,L,C per line.
Minimum: N data points. More data gives a smoother band.
Bollinger Bands Chart
Price, middle band, and upper/lower bands plotted over time. Hover to inspect values.
Detailed values
| Index | Price | Middle | Upper | Lower | Band width | %B | Signal |
|---|
What are Bollinger Bands?
Bollinger Bands are a popular technical analysis indicator created by John Bollinger. They consist of:
- Middle band: a moving average of price (usually a 20-period SMA).
- Upper band: middle band plus K standard deviations of price.
- Lower band: middle band minus K standard deviations of price.
The bands expand when volatility increases and contract when volatility falls. Traders use them to identify relative high and low prices, volatility squeezes, and potential breakout or mean-reversion opportunities.
Formulas for Bollinger Bands
1. Moving average (middle band)
For a simple moving average (SMA) over \(N\) periods:
\[ \text{SMA}_t = \frac{1}{N} \sum_{i=0}^{N-1} P_{t-i} \]
For an exponential moving average (EMA):
\[ \alpha = \frac{2}{N+1}, \quad \text{EMA}_t = \alpha P_t + (1-\alpha)\,\text{EMA}_{t-1} \]
2. Standard deviation of price
\[ \sigma_t = \sqrt{\frac{1}{N} \sum_{i=0}^{N-1} (P_{t-i} - \text{MA}_t)^2} \]
3. Upper and lower bands
\[ \text{Upper}_t = \text{MA}_t + K \cdot \sigma_t \]
\[ \text{Lower}_t = \text{MA}_t - K \cdot \sigma_t \]
4. Band width
\[ \text{BandWidth}_t = \frac{\text{Upper}_t - \text{Lower}_t}{\text{MA}_t} \]
5. %B indicator
\[ \%B_t = \frac{P_t - \text{Lower}_t}{\text{Upper}_t - \text{Lower}_t} \]
Values near 0 mean price is near the lower band; values near 1 mean price is near the upper band.
How to use this Bollinger Bands calculator
- Collect your price data. Export closing prices from your broker or charting platform. For typical or weighted price, export high, low, and close.
-
Paste the data. Enter one value per line for
Close, or
high,low,closeper line for Typical/Weighted price. - Set period and deviations. 20 periods and 2 standard deviations are the classic settings used by John Bollinger.
- Choose SMA or EMA. SMA is standard; EMA reacts faster to recent price changes.
- Click “Calculate”. The tool computes the middle, upper, and lower bands, band width, and %B for each bar.
- Study the chart and table. Look for touches or breaks of the bands, squeezes (narrow bands), and expansions (wide bands).
Interpreting Bollinger Bands in trading
1. Relative highs and lows
- Price near the upper band = relatively high vs. recent average.
- Price near the lower band = relatively low vs. recent average.
- Price around the middle band = near its recent mean.
This does not automatically mean “sell at the upper band” or “buy at the lower band”. In strong trends, price can “walk the band” and stay near one side for a long time.
2. Bollinger Band squeeze
A squeeze occurs when band width becomes unusually small. It signals low volatility and often precedes a strong move. However, the bands do not predict the direction of the breakout.
- Very low band width + breakout above upper band → possible bullish continuation or reversal.
- Very low band width + breakout below lower band → possible bearish continuation or reversal.
3. Mean reversion vs. trend following
Traders use Bollinger Bands in two main ways:
- Mean reversion: fade moves to the bands, expecting price to revert toward the middle band.
- Trend following: trade in the direction of band breaks, especially after a squeeze.
In practice, Bollinger Bands are usually combined with other tools (trend filters, volume, RSI, MACD, price action) to reduce false signals.
Best practices & common mistakes
- Be consistent with parameters. If you backtest with 20, 2.0, don’t trade live with 10, 3.0.
- Adjust to your timeframe. Intraday traders may use shorter periods (e.g., 20 bars on a 5‑minute chart).
- Don’t treat bands as hard support/resistance. They are statistical envelopes, not guaranteed reversal zones.
- Watch volatility regime changes. A transition from wide to narrow bands (and vice versa) often marks a change in market behavior.
- Risk management first. Always define position size, stop-loss, and maximum risk per trade.
FAQ
What settings should I use for Bollinger Bands?
The classic settings are a 20-period simple moving average and 2 standard deviations. Many traders start with these and only adjust after careful testing on their specific market and timeframe.
Can I use Bollinger Bands on crypto, forex, or stocks?
Yes. Bollinger Bands are price- and volatility-based, so they can be applied to any liquid market: stocks, ETFs, forex, crypto, commodities, and indices.
Are Bollinger Bands better with SMA or EMA?
SMA is the original choice and is more common. EMA reacts faster to recent price changes and may be preferred by short-term traders. This calculator lets you compare both.
Is this Bollinger Bands calculator suitable for backtesting?
It’s ideal for quick analysis and strategy prototyping. For full-scale backtesting on thousands of bars, you’ll usually export data and implement your rules in a dedicated backtesting platform, but you can still use this tool to verify formulas and spot-check signals.