Bollinger Bands calculator
Bollinger Bands wrap a moving average in a channel that widens and narrows with volatility, which makes them useful for judging whether a price is stretched and whether a quiet market is about to move. Paste your closing prices, choose the period and band width, and this calculator works out the upper, middle and lower bands for every bar. It also gives the latest %B and bandwidth and flags a squeeze when the bands are unusually narrow.
Price and bands
Closing prices with the upper, middle and lower bands. Narrowing bands show falling volatility.
Recent values
The latest bars with their bands, %B and bandwidth.
| Date | Close | Lower | Middle | Upper | %B | Bandwidth |
|---|
How the bands are calculated
Every value uses only the most recent closes in the window, so the first full reading appears once there are as many bars as the period.
Middle band
The simple moving average of the last N closes.
middle = average of the last N closes
Standard deviation
How far those closes typically sit from their average, using the population formula.
SD = √(average of (close − middle)²)
Upper and lower bands
The middle band plus and minus your band width in standard deviations.
upper = middle + k × SD, lower = middle − k × SD
%B
Where the close sits between the bands.
%B = (close − lower) ÷ (upper − lower)
Bandwidth and squeeze
Band width relative to the middle band; a squeeze is bandwidth within 10% of its low over the last 50 readings, or under 60% of its average.
bandwidth = (upper − lower) ÷ middle
Bollinger Bands questions
How are Bollinger Bands calculated?
The middle band is a simple moving average of closing prices, usually over 20 periods. The upper and lower bands sit a set number of standard deviations above and below it, usually 2. Because standard deviation measures how spread out recent prices are, the bands widen when the market is volatile and narrow when it is quiet.
What is %B?
%B shows where the latest close sits relative to the bands. 0 means it is on the lower band, 0.5 on the middle band and 1 on the upper band. Values above 1 or below 0 mean the price has closed outside the bands.
What is bandwidth?
Bandwidth is the distance between the upper and lower bands divided by the middle band. It measures volatility in a way you can compare over time. Very low bandwidth compared with recent history is called a squeeze.
What is a Bollinger squeeze?
A squeeze is a period of unusually narrow bands, when volatility has dropped to a low for the recent past. Quiet periods tend to be followed by bigger moves, so traders watch squeezes for a breakout, though the bands do not say which direction it will go.
Does touching the upper band mean the price will fall?
Not on its own. In strong uptrends price can ride along the upper band for weeks. Closes outside the bands show strength or weakness, and many traders combine the bands with trend or momentum tools rather than treating a touch as a signal.
Which standard deviation does the calculator use?
It uses the population standard deviation over the period, which is how John Bollinger defined the bands and how most charting platforms calculate them. Results should match your charts to within rounding.