Academy · · 13 min · By Álvaro García
Bollinger Bands: Formula, Settings & Strategy Guide
Bollinger Bands explained: the formula with a worked (20, 2) example, %B, the squeeze, common settings, 3 ways to use them and the costliest mistakes.

In short: Bollinger Bands are a volatility indicator made up of a 20-period simple moving average and two bands set 2 standard deviations above and below it. When the market calms down, the bands narrow; when it turns volatile, they widen. Touching a band is not a buy or sell signal: it is information to confirm with the trend and other indicators.
Bollinger Bands are a technical analysis indicator that draws a channel around the price to measure its volatility: a centre line (the 20-period simple moving average) and two bands at ±2 standard deviations. They tell you whether the price is relatively high or low compared with its recent behaviour, and they help you spot quiet phases that often come before strong moves.
In this guide you will find the full Bollinger Bands formula with a numerical example worked out step by step, how to read %B and BandWidth, the three most common ways to use the bands, and the mistakes that cost beginners the most money.
What are Bollinger Bands?
Bollinger Bands are a volatility indicator created by the American analyst John Bollinger in the 1980s. They are plotted on top of the price chart and consist of three lines: a central moving average and two outer bands whose distance from it depends on the standard deviation of recent prices.
The idea is simple. Instead of drawing a channel of fixed width (for example, 3% above and below the average), Bollinger made the channel adapt to volatility on its own. If the price moves a lot, the standard deviation rises and the bands move apart; if it moves little, they come together. That is why the same indicator works on a quiet stock, on EUR/USD or on bitcoin.
One curiosity: in 2011 John Bollinger registered the phrase "Bollinger Bands" as a trademark in the United States, according to Wikipedia. The calculation itself, however, is public and every charting platform includes it.
How to calculate Bollinger Bands: the formula
With the standard (20, 2) setting, which is the default on almost every platform according to StockCharts ChartSchool, the three lines are calculated like this:
- Middle band = simple moving average (SMA) of the last 20 closes.
- Upper band = middle band + 2 × the standard deviation of those 20 closes.
- Lower band = middle band − 2 × the standard deviation of those 20 closes.
One detail that many guides overlook: Bollinger uses the population standard deviation, which means dividing by n (20) rather than by n − 1 (19). If you build the indicator yourself in a spreadsheet, use STDEV.P and not STDEV.S; otherwise your bands will come out slightly wider than the ones on your platform.
If you are not sure how the centre line works, review our guide to moving averages: Bollinger Bands are nothing more than a simple average with a volatility "cushion" on each side.
Bollinger Bands worked example, step by step
To show you the whole calculation, we take an illustrative series (not a real quote) of 20 closing prices for a stock that rises slowly: 100; 101; 100.5; 102; 103; 102.5; 104; 103.5; 105; 104; 103; 104.5; 106; 105.5; 107; 106; 105; 106.5; 108 and 107.5.
- Average of the 20 closes: the sum is 2,084.5, so the middle band is 2,084.5 ÷ 20 = 104.23.
- Population standard deviation: subtract 104.23 from each close, square the differences, take the average of those squares and then the square root. The result is 2.24 (with the sample method, dividing by 19, you would get 2.30).
- Upper band: 104.23 + 2 × 2.24 = 108.71.
- Lower band: 104.23 − 2 × 2.24 = 99.74.
The last close (107.5) is inside the channel, in the upper half. In the next session the calculation is repeated, dropping the oldest close and adding the new one, which is why the bands move every day.
What is %B and how do you read it?
%B tells you where the price sits within the channel. It equals 1 when the price touches the upper band, 0 when it touches the lower band and 0.5 when it is on the middle band. Above 1 or below 0 means the price has left the channel. It is the quickest way to compare different assets on the same scale.
The formula, as given by StockCharts, is: %B = (price − lower band) ÷ (upper band − lower band).
With our example: (107.5 − 99.74) ÷ (108.71 − 99.74) = 7.76 ÷ 8.97 = 0.86. The price is in the upper part of the channel, but still inside it. If it closed at 109 the next day and, to keep things simple, the bands did not change, %B would be 1.03: it would have broken out to the upside. In practice the bands are recalculated with that new close, so the real %B would be somewhat lower.
BandWidth and the squeeze: when the market goes quiet
BandWidth measures the width of the channel as a percentage of the average: BandWidth = (upper band − lower band) ÷ middle band × 100. In the example, (108.71 − 99.74) ÷ 104.23 × 100 = 8.61%.
What matters is not the isolated number but how it evolves. When BandWidth falls to low levels compared with recent months, the bands are "tight": this is what is known as the squeeze. StockCharts recommends judging whether the bands are narrow by looking at a chart covering 8 to 12 months.
The logic is that volatility runs in cycles: after a very quiet phase, a volatile one usually follows. The squeeze, however, does not tell you which way the move will go. And the first breakout can be false (traders call it a head-fake): the price breaks out upwards, traps the buyers and then turns sharply down. That is why it pays to wait for confirmation before acting.
The opposite case is useful too: when a sudden move arrives, the standard deviation of the last 20 closes rises and the bands open up all at once. You can compare the volatility of different markets with our volatility tool.
What the data says: the S&P 500 and bitcoin over the past year
To check whether the theory holds, at Audited Traders we calculated Bollinger Bands (20, 2) using the daily closes of the S&P 500 and of bitcoin between 3 December 2025 and 2 December 2026 (daily closes from Yahoo Finance; for bitcoin, the 24-hour daily close in UTC; a window of 20 closes that includes the day's own close). These are the results:
| Data (bands 20, 2) | S&P 500 | Bitcoin |
|---|---|---|
| Closes analysed | 251 sessions | 365 days |
| Closes above the upper band | 5 | 20 |
| Closes below the lower band | 17 | 21 |
| Closes inside the bands | 91.2% | 88.8% |
| Lowest BandWidth of the year | 2.13% (31 August) | 4.25% (15 August) |
| Median BandWidth | 4.08% | 11.50% |
| Highest BandWidth of the year | 15.36% (23 April) | 44.62% (12 February) |
| Longest streak of closes outside a band | 2 sessions | 6 days (below the lower band, until 6 June) |
Three practical conclusions. First: the share of closes inside the channel (91% and 89%) is in line with the 88-89% that Bollinger mentions, as reported by StockCharts, and is well short of the theoretical 95%. Second: a "normal" BandWidth depends on the asset. A 10% reading is high volatility for the S&P 500 and fairly low for bitcoin, so the squeeze is always measured against the asset's own history. Third: the S&P 500 closed below the lower band more often than above the upper band in this year of corrections.
Two real squeezes from 2026: one worked and one fooled traders
Bitcoin, August 2026. On 15 August BandWidth hit its low for the year (4.25%) with bitcoin at $63,024. Four days later, on 19 August, it closed above the upper band ($69,266) and went on to string together five consecutive closes above the upper band, a sign of how strong the trend was. On 27 August it closed at $80,258, 27.3% above the day of the squeeze, with BandWidth at 39.6%.
S&P 500, September 2026. On 31 August the index recorded its lowest BandWidth of the year (2.13%). The first breakout was to the downside: on 16 September it closed at 7,551.81 points, below the lower band (7,563.95). The next day it was back inside the channel, and on 6 October the breakout came to the upside (7,818.93, above an upper band of 7,816.09). Anyone who sold on the first breakout suffered a textbook head-fake.
A word of caution: these are two examples chosen to illustrate the squeeze, not a statistic, and the analysis covers a single year and two assets. It is not a backtest and does not prove that a rule based on the bands makes money. You can follow prices in our crypto and stocks sections.
Bollinger Bands strategy: 3 ways to use them
1. In a range: bounces between the bands
When the price has no clear trend and the middle band is almost flat, the bands act as a dynamic ceiling and floor. A touch of the lower band can anticipate a bounce towards the average, and a touch of the upper band, a pullback. It works better when it coincides with a horizontal support or resistance and when an oscillator such as the RSI shows divergence.
2. In a trend: "walking the bands"
In a strong trend, the price can hug the upper band (or the lower band in a decline) for days or weeks. Bollinger calls this walking the bands. In that context, touching the upper band is not a sign that the price is "expensive": it is a sign of strength. Many traders then use the middle band as a reference: as long as the price closes above it, the uptrend remains intact.
3. Breakout after a squeeze
After a squeeze, a clear close outside the bands, with BandWidth starting to rise, shows that volatility is returning. Confirmation is usually sought through volume, a MACD crossover, or by waiting to see that the price does not return inside the channel in the following sessions.
Bollinger Bands and RSI: how to combine them
The bands measure volatility and the RSI measures momentum, so they complement each other. A common way to read them together:
- First touch: the price closes below the lower band (%B below 0) and the 14-period RSI drops below 30.
- Second touch: days later the price makes a lower low, but this time it closes inside the channel (%B above 0) and the RSI makes a higher low than at the first touch.
- Reading: that divergence suggests selling pressure is losing strength. It is a warning sign, not an order: many traders also wait for a close above the middle band before considering an entry, and always with a defined stop.
Bollinger describes a similar pattern, the "W-bottom", in which the second low stays inside the bands. The opposite (an M-top) works in the upper part of the channel.
How to add Bollinger Bands on TradingView and MetaTrader
- TradingView: click "Indicators", type "Bollinger" and choose "Bollinger Bands" (BB). In the settings you will see the length (20), the type of moving average for the basis line (SMA), the source (close) and the standard deviation multiplier (2).
- MetaTrader 5 and MetaTrader 4: menu Insert → Indicators → Trend → Bollinger Bands. The default parameters are period 20, shift 0 and deviations 2, applied to the close.
If you switch platforms, check that both use the same average (simple) and the same multiplier; if not, the bands will not match and neither will the %B readings.
Bollinger Bands and risk management
The bands also help you decide where to place the stop and, therefore, how much to buy. Continuing with the example, imagine an account of €10,000 on which you do not want to risk more than 1% per trade (€100).
- If you buy at 107.5 and place the stop just below the middle band (104.23), the distance is €3.27 per share. 100 ÷ 3.27 = 30.6, so the maximum size is 30 shares (actual risk: 30 × 3.27 = €98.10).
- If you prefer a wider stop, below the lower band (99.74), the distance rises to €7.76: 100 ÷ 7.76 = 12.9, that is, 12 shares (actual risk: €93.12).
A wider stop does not mean more risk if you reduce the size. You can do these sums with our position size calculator or review the method in the position sizing guide. Remember that a stop can be filled worse than planned if the price gaps at the open, and that trading with leverage or CFDs can make you lose money faster than you expect (see the risk warning).
Bollinger Bands settings: is (20, 2) the only option?
The (20, 2) setting is the starting point, but Bollinger suggests adjusting the multiplier if you change the period, according to StockCharts: raise it to 2.1 with a 50-period average and lower it to 1.9 with a 10-period one. The reason is that a shorter average has less data and the bands tend to stay narrow; the adjustment compensates for that effect.
| Setting | Period | Multiplier | Typical use |
|---|---|---|---|
| Short | 10 | 1.9 | Moves lasting a few days or intraday charts |
| Standard | 20 | 2 | General use, the default setting |
| Long | 50 | 2.1 | Trends lasting several months |
How often do prices stay inside Bollinger Bands?
With a normal distribution, around 95% of closes would fall within ±2 standard deviations. But markets have fat tails: the studies cited on Wikipedia put the real figure at around 88% (between 85% and 90%), and our calculation for the past year gives 91% for the S&P 500 and 89% for bitcoin. A close outside the bands deserves attention, but it happens roughly one session in ten.
Common mistakes with Bollinger Bands
- Selling just because the price touches the upper band. StockCharts reminds us that, for Bollinger, touching a band is a "tag", not a signal. In an uptrend, the price can walk the upper band for weeks.
- Using them as your only indicator. They are designed to be combined with trend analysis and other indicators that measure different things (momentum, volume).
- Treating the squeeze as a directional signal. Narrow bands warn that volatility is coming, not whether the price will rise or fall.
- Changing the parameters until they "work" on past data. Optimising on old data gives a false sense of precision.
- Forgetting position size. A good read of the chart does not make up for risking too much on a single trade.
It pays to keep realistic expectations: academic studies on trading rules based on Bollinger Bands give mixed results, and Wikipedia cites work by Lento and other authors (2007) that found no consistent improvement over buy and hold; in some markets, even the contrarian strategy (doing the opposite of the signal) performed better. No figure is guaranteed. This guide is educational content and does not constitute investment advice.
Summary table
| Concept | Formula or rule | What it tells you |
|---|---|---|
| Middle band | 20-period SMA | The short-term trend |
| Upper and lower bands | SMA ± 2 standard deviations (population) | Whether the price is high or low relative to its recent volatility |
| %B | (price − lower) ÷ (upper − lower) | Position within the channel: 0 at the bottom, 1 at the top |
| BandWidth | (upper − lower) ÷ middle × 100 | Channel width; relative lows = squeeze |
| Walking the bands | Repeated closes next to a band | Strong trend, not an overbought signal |
| Parameter adjustment | (10; 1.9) · (20; 2) · (50; 2.1) | Fit the channel to the time horizon |
If you want to continue with technical analysis, combine this guide with the one on Fibonacci retracements and browse the rest of the guides in the Academy.
Frequently asked questions
What does it mean when the price touches the upper Bollinger Band?
It means the price is relatively high compared with its last 20 periods. On its own it is not a sell signal: in a strong uptrend the price can keep hugging the upper band for days. You need to confirm it with the trend and other indicators.
What are the best Bollinger Bands settings?
The standard is 20 periods and 2 standard deviations. For shorter horizons, Bollinger suggests 10 periods with 1.9, and for longer ones, 50 periods with 2.1. There is no setting that always works: what matters is to use the same one consistently.
What is the Bollinger squeeze?
It is a phase in which the bands narrow to low levels compared with previous months because volatility has fallen. It usually comes before a strong move, but it does not indicate the direction, and the first breakout can be false.
Do Bollinger Bands work in forex and crypto?
Yes. They are calculated the same way on any asset with a price, from EUR/USD to bitcoin, because they adapt to each one's volatility. In very volatile markets the bands will be wider and closes outside the channel more abrupt.
Is it better to combine Bollinger Bands with the RSI or with the MACD?
Both are useful because they measure different things: the bands measure volatility, while the RSI or the MACD measure momentum. A touch of the lower band with bullish RSI divergence is a stronger reading than the isolated touch. No combination removes the risk of loss.