This guide explains how Bollinger Bands are calculated, how to measure a squeeze, the breakout rules, a worked example, the main risks and how to automate and test the strategy.
At a glance
| Bollinger Band breakout | |
|---|---|
| Style | Volatility breakout, trend following |
| Instruments | Index futures, stocks |
| Timeframe | 15-minute to daily candles |
| Indicator | 20-period moving average with bands at 2 standard deviations |
| Setup | A squeeze: the bands at their narrowest in months |
| Entry | A close outside the band after the squeeze |
| Exit | A close back inside the middle band, or a trailing stop |
How Bollinger Bands are calculated
Bollinger Bands were developed by John Bollinger in the 1980s.
- Middle band: the 20-period simple moving average of the close.
- Upper band: the middle band plus 2 standard deviations of the last 20 closes.
- Lower band: the middle band minus 2 standard deviations.
Two related measures help with breakouts:
- Bandwidth: (upper band − lower band) ÷ middle band. Low bandwidth means a squeeze.
- %b: where the price sits within the bands. Above 1 means above the upper band; below 0 means below the lower band.
Example. If the 20-day average is ₹500 and the standard deviation of the last 20 closes is ₹6, the bands are at ₹488 and ₹512. Bandwidth is 24 ÷ 500 = 4.8%.
Why squeezes lead to breakouts
Volatility tends to move in cycles: quiet periods are often followed by active ones. A squeeze shows a market coiling. It does not say which way the breakout will go, which is why the strategy waits for the price to choose a direction before entering.
The rules
- Find the squeeze. Bandwidth falls to its lowest level in the last 120 candles, or below a chosen threshold.
- Wait for a close outside a band. Buy on a close above the upper band; sell on a close below the lower band.
- Confirm, if you want. Require volume above its 20-period average on the breakout candle.
- Stop. Place the stop at the middle band or on the opposite side of the squeeze range.
- Exit. Close the trade when the price closes back below the middle band, or trail the stop under recent lows.
A worked example
This is a hypothetical example, not a result.
- A stock's bandwidth on a daily chart falls to 4.5%, its lowest in six months. The bands sit at ₹492 and ₹514.
- A candle closes at ₹517, above the upper band, on volume twice its 20-day average.
- The algo buys 200 shares at the next open, ₹518, with a stop at the middle band, ₹503. The risk is 200 × ₹15 = ₹3,000.
- The stock trends to ₹560 over three weeks, then closes at ₹541, below the rising middle band.
- The algo sells at the next open, ₹540, for a gain of 200 × ₹22 = ₹4,400 before costs.
False breakouts
The main risk is a break that immediately reverses. Prices can close outside a band, then fall back inside and break out the other way. Ways to reduce false breakouts:
- Require volume confirmation on the breakout candle. See the volume breakout strategy.
- Require two closes outside the band instead of one.
- Filter by trend, taking only upside breakouts when the longer-term trend is up.
- Exit quickly if the price closes back inside the bands within a set number of candles.
Breakout vs mean reversion with Bollinger Bands
The same bands support two opposite strategies. A breakout strategy buys strength above the upper band after a squeeze. A mean reversion strategy buys weakness below the lower band and targets the middle band. The squeeze filter is what separates them. See the Bollinger Band mean reversion guide for the other approach.
Position sizing and risk
Size each trade by the distance to the stop, using the position size calculator. Breakout strategies usually win less than half the time, with larger wins paying for smaller losses, so expect losing streaks and check them in your backtest.
Automating the strategy
Squeezes can take weeks to form and breakouts can happen at any time, which makes this strategy hard to watch by hand. QuantPower's strategy builder lets you set indicator conditions for entries and exits, add volume or trend filters, and attach stops. Test the rules in the backtesting engine and paper trading before going live.
Start your free trial
Connect your broker, build a strategy and test it on paper before a single live order goes out.
Backtesting tips
- Define the squeeze precisely, for example as the lowest bandwidth in 120 candles.
- Test neighbouring settings: 20 or 30 periods; 2 or 2.5 standard deviations.
- Fill at the next price after the breakout candle closes.
- Look at false-breakout rates separately from overall profit.
See how to backtest trading strategies.
Frequently asked questions
What is a Bollinger Band squeeze?
A period when the bands narrow to their tightest in a long while, showing unusually low volatility. Squeezes are often followed by larger moves.
Is a close above the upper band a buy signal?
Not on its own. In a mean reversion strategy it can be a sign of overextension. In a breakout strategy it is a signal only after a squeeze and, ideally, with confirmation.
What settings should I use?
The standard is a 20-period average with bands at 2 standard deviations. Test small changes rather than optimising one exact setting.
Does this work on Nifty?
Bollinger breakouts are widely used on Nifty futures and stocks. They work best when quiet periods give way to trends, and poorly when breakouts keep failing.
Sources
- Bollinger, J. (2001). Bollinger on Bollinger Bands. McGraw-Hill
