Bollinger Bands Calculation Formula Calculator
Estimate the simple moving average, upper band, lower band, bandwidth, and %B using your own closing price series. This calculator applies the classic Bollinger Bands formula with a rolling period and standard deviation multiplier.
Interactive Calculator
What Is the Bollinger Bands Calculation Formula?
Bollinger Bands are a volatility-based technical analysis tool built around a moving average. They were popularized by John Bollinger and are designed to show how far price has moved from its recent average. The indicator has three core lines: a middle band, which is usually a simple moving average; an upper band; and a lower band. The outer bands expand when volatility rises and contract when volatility falls.
The indicator is widely used by traders in equities, foreign exchange, futures, crypto, and exchange-traded funds because it combines trend and volatility into one framework. That said, the math behind the indicator is straightforward, and understanding the formula makes it easier to interpret what the bands are actually telling you.
Upper Band = SMA(n) + k × Standard Deviation(n)
Lower Band = SMA(n) – k × Standard Deviation(n)
In the classic setup, n = 20 periods and k = 2 standard deviations. The 20-period simple moving average represents the recent average price. The standard deviation measures how dispersed recent prices are around that average. When prices become more dispersed, the bands widen. When prices become tightly clustered, the bands narrow.
Breaking Down Each Part of the Formula
1. The Simple Moving Average
The middle band is usually a simple moving average, or SMA. To calculate a 20-period SMA, you add the last 20 closing prices and divide by 20. If your last 20 closes sum to 2,200, then the SMA is 110. This centerline acts as the reference point for the upper and lower bands.
The moving average is not a forecast. It is a smoothing mechanism. Because it averages several data points, it reacts more slowly than raw price. That lag is useful because it reduces noise and gives the standard deviation calculation a stable anchor.
2. The Standard Deviation
Standard deviation is the mathematical heart of Bollinger Bands. It measures how spread out the prices are from the average. If recent closes are all very near the SMA, standard deviation is low, and the bands sit close to the middle line. If closes vary sharply, standard deviation is high, and the bands spread farther apart.
The basic process is:
- Calculate the moving average for the selected period.
- Subtract the average from each closing price in the period.
- Square each difference.
- Average the squared differences.
- Take the square root of that average.
Many charting platforms use the population-style standard deviation for the Bollinger Bands lookback window. Some tools may vary slightly, which is why your results can differ by a small amount from one platform to another.
3. The Multiplier
The multiplier determines how wide the bands are relative to the measured volatility. With a multiplier of 2, the upper band is two standard deviations above the SMA, and the lower band is two standard deviations below it. Increasing the multiplier creates wider bands and fewer touches. Decreasing it creates tighter bands and more frequent touches.
Step-by-Step Example of the Bollinger Bands Formula
Suppose the latest 20 closing prices produce the following statistics:
- 20-period SMA = 115.40
- 20-period standard deviation = 3.25
- Multiplier = 2
Then the bands are:
- Upper Band = 115.40 + (2 × 3.25) = 121.90
- Lower Band = 115.40 – (2 × 3.25) = 108.90
If the latest closing price is 120.50, it is trading near the upper band but not above it. That does not automatically mean the asset is overbought. It simply means price is elevated relative to its recent average and current volatility. Context still matters, including trend strength, volume, market regime, and whether price is hugging the band or reversing sharply.
Why Traders Use Bollinger Bands
Many traders like Bollinger Bands because they answer several practical questions at once. Is volatility rising or falling? Is price stretched relative to recent norms? Is the market consolidating or expanding? Are breakouts occurring from low-volatility conditions? This makes the indicator useful for both mean-reversion traders and momentum traders, although they use it differently.
- Mean reversion: Some traders look for price to revert back toward the middle band after touching an outer band.
- Trend confirmation: In strong trends, price may ride the upper band in an uptrend or the lower band in a downtrend.
- Volatility analysis: Narrow bands can suggest compressed volatility, while widening bands reflect expansion.
- Pattern recognition: Traders often combine Bollinger Bands with RSI, MACD, support and resistance, or candlestick structure.
Interpreting Band Width, %B, and the Squeeze
Beyond the three main lines, two derived measures are especially useful.
Bandwidth
Bandwidth measures the distance between the upper and lower bands relative to the middle band. A common formula is:
This helps compare volatility across securities with different price levels. A stock trading at 20 and a stock trading at 200 can still be compared meaningfully with bandwidth percentages.
Percent B
Percent B, often written as %B, measures where price sits between the lower and upper band:
If %B equals 0, price is at the lower band. If %B equals 0.5, price is at the middle of the band range. If %B equals 1, price is at the upper band. Values above 1 indicate price has moved above the upper band; values below 0 indicate a move below the lower band.
One of the best-known concepts is the Bollinger squeeze. This occurs when the bands contract to unusually narrow levels. Because low volatility often precedes higher volatility, traders watch squeezes for breakout potential. However, a squeeze does not predict direction. It only suggests that a larger move may be approaching.
Comparison Table: Standard Deviation Coverage Under a Normal Distribution
The reason traders often use a 2-standard-deviation band comes from the statistical properties of the normal distribution. In a perfectly normal distribution, a known share of observations falls within one, two, and three standard deviations of the mean.
| Distance from Mean | Expected Coverage | Interpretation for Bollinger Bands |
|---|---|---|
| ±1 standard deviation | 68.27% | Band is tight and will be touched more often |
| ±2 standard deviations | 95.45% | Classic default that balances sensitivity and noise |
| ±3 standard deviations | 99.73% | Very wide band, fewer signals, stronger extremes |
These percentages are mathematically real, but financial returns are not perfectly normal. Markets can exhibit skewness, kurtosis, clustering, jumps, and trending behavior. That means prices may touch or exceed the outer bands more often than a textbook normal distribution would imply. This is one reason Bollinger Bands should not be treated as a rigid probability model.
Comparison Table: Practical Effects of Different Settings
| Setting | Typical Use | Strength | Trade-Off |
|---|---|---|---|
| 10 periods, 2 standard deviations | Short-term trading | Faster reaction to new price changes | More noise and more false touches |
| 20 periods, 2 standard deviations | General-purpose default | Balanced view of trend and volatility | Can lag during rapid regime shifts |
| 50 periods, 2 standard deviations | Swing or position analysis | Smoother, less noisy structure | Signals arrive later |
| 20 periods, 1 standard deviation | Aggressive mean reversion | More frequent interactions with bands | Higher chance of weak signals |
| 20 periods, 3 standard deviations | Extreme-move filtering | Highlights unusually large moves | May miss many actionable setups |
Important Limits of the Bollinger Bands Formula
Bollinger Bands are descriptive, not predictive. They describe where price sits relative to a recent moving average and recent volatility. They do not tell you why the market is moving, nor do they guarantee reversal after a band touch. In a strong trend, price can stay near one band for a long time. In choppy conditions, repeated band touches can trigger false signals.
They also depend heavily on the lookback period and multiplier. A short period can overreact. A long period can underreact. Standard deviation is sensitive to outliers, so one extreme close can widen the bands sharply. For this reason, many professionals use Bollinger Bands alongside trend filters, volume, support and resistance zones, and broader risk management rules.
How This Calculator Computes the Result
This page calculates the latest Bollinger Bands reading from the data you enter. It also plots the rolling series on a chart so you can see how the moving average and outer bands evolved over time. The workflow is simple:
- Paste a list of closing prices.
- Choose a moving average period.
- Select a standard deviation multiplier.
- Click the calculate button.
- Review the latest SMA, upper band, lower band, standard deviation, bandwidth, and %B.
The chart updates automatically using Chart.js. This visual view matters because one static band value is rarely enough. Traders typically want to see whether the bands are narrowing, widening, or being repeatedly tested over multiple bars.
Best Practices for Using Bollinger Bands
- Use a consistent data frequency, such as daily closes or hourly closes, rather than mixing intervals.
- Compare current band width with recent history to identify compression and expansion.
- Combine with momentum indicators when testing breakout versus mean-reversion logic.
- Backtest your chosen settings on the asset you actually trade.
- Remember that different markets have different volatility structures.
- Always use risk controls, because volatility indicators cannot prevent losses.
Authoritative Statistical and Investor Education Sources
If you want a stronger foundation in standard deviation, probability, and market risk concepts that support understanding Bollinger Bands, these sources are useful:
- NIST Engineering Statistics Handbook
- U.S. SEC Investor.gov: Volatility
- Duke University: Standard Deviation and Forecast Error Concepts
Final Takeaway
The Bollinger Bands calculation formula is elegant because it combines a moving average with a volatility measure. The moving average shows the recent central tendency of price, while standard deviation measures how much price is dispersing around that center. Together, they create an adaptive envelope that responds to changing market conditions. The most common formula uses a 20-period SMA and bands set two standard deviations above and below the average, but traders frequently customize those values.
Understanding the formula directly gives you an edge over simply reading the indicator visually. You can interpret whether a wide band reflects genuine volatility expansion, whether a narrow band suggests compression, and whether a price move near the upper or lower band is statistically notable in the context of your chosen settings. Use the calculator above to test different data series and see how changing the period or multiplier alters the bands.