Bollinger bands are the indicator most people recognise from a chart: a middle line with two lines wrapped around the price, one above and one below. They look like a rule. They are not one until you say exactly when you go in, when you come out and how much you hold. This module writes the bands down as arithmetic, works one day by hand, and then tests two opposite rules built from the same bands, plus a third idea that uses volatility to size a position instead of timing it. Everything is run on the Nifty 50 price index, the test script prints every figure, and I quote only what it prints. Two of the three rules did worse than simply holding the index over the same dates. I say so where it happens.
One warning before the results. The data runs from 1 Jan 2021 to 30 Sep 2026, about five and three quarter years, in one market regime. That is a short sample. Treat each result as one test, not as proof of anything. Education only, not advice.
6By the end you can
- Compute a Bollinger band by hand from 20 closes: the average, the standard deviation and the two outer lines.
- Say what band width measures and what it did on the Nifty 50 between Jan 2021 and Sep 2026.
- Write the touch reversion rule and the breakout rule as exact entry and exit conditions.
- Read a result against buy and hold over the same dates, with the number of trades and the time in the market.
- Explain how a volatility target sizes a position, and what it did to return and drawdown on this data.
- Name the reasons a short test of a band rule cannot settle the question.

What a Bollinger band is
The bands come from John Bollinger, who set out the method and its default settings in his book listed under sources. There are three lines. The middle line is the simple moving average of the last 20 closes. The upper band is that average plus two standard deviations of the same 20 closes. The lower band is the average minus two standard deviations. The standard deviation measures how far the closes scattered around their own average. When prices are calm, the 20 closes sit close together and the bands are tight. When prices swing, the bands open up.
SD = sqrt(average of
(close - Middle)^2)
Upper = Middle + 2 x SD
Lower = Middle - 2 x SD
Read one more paragraph, 72 words
Two more numbers come out of the same line. Band width tells you how wide the bands are as a share of the middle line, so it can be compared across years when the index level was very different. And %B tells you where the close sits inside the bands: 0 when the close is on the lower band, 1 when it is on the upper band, 0.5 on the middle line.
One day worked by hand
Here is the last day of the data, 30 Sep 2026, so you can redo it with a calculator. The 20 closes run from 2 Sep 2026, when the index closed at 23,914.45, to 30 Sep 2026, when it closed at 22,620.45.
2 terms this section turns on
Nifty 50 price index closes, 2 Sep 2026 to 30 Sep 2026, from the daily closes file used throughout this path. Dividends not included.
Read one more paragraph, 71 words
Notice what the bands did not do. They did not forecast anything. They described the last 20 days: the index had drifted down through that month and finished at the edge of its own recent range. Whether that edge is a place to expect a bounce or a place to expect more of the same is a claim about the future, and that claim is what a rule has to test.
What the bands say about volatility
Because the standard deviation is the engine, the bands are really a picture of recent volatility with a moving average attached. Band width makes that visible. Across the 1,401 sessions in this data that have a full 20 day band, the narrowest band was 1.51% of the middle line, on 2 Jul 2021. The median was 5.26%. The widest was 15.31%, on 23 Mar 2026. Inside five years the bands went from a thin ribbon to a wide channel around the same average.
| Close relative to bands | Sessions | Share |
|---|---|---|
| Above the upper band | 71 of 1,401 | 5.1% |
| Below the lower band | 67 of 1,401 | 4.8% |
| Bell curve expectation, each side | not counted | 2.3% |
Nifty 50 price index, sessions with a full band, to 30 Sep 2026. The 2.3% is the textbook share beyond two standard deviations on one side of a bell shaped distribution.
Read 2 more paragraphs, 140 words
The intuition many people carry is that only a small share of closes fall outside two standard deviations, and that is where the idea of a rare "touch" comes from. For a bell shaped distribution the share beyond two standard deviations is about 2.3% on each side. The real count on this index was higher:
Closes outside the bands were about twice as common as a bell curve says. That is the familiar fat tail: big days come in clusters, and a cluster of big days drags the bands wider while it is happening, so the same price can be inside the bands one week and outside them the next. This matters for the rules below. A touch of the lower band is not a one in forty event. On this data it happened on about one session in twenty.
₹100 in Allcap became about ₹424 in the model
How these tests are built
Every test in this path follows the same few lines, set out in module 23.1. The signal is computed from the close of day t. The trade happens at the close of day t+1, never at the same close that created the signal. Each entry and each exit costs 0.1% of the value traded, an illustration of costs and not a quote from any broker. When the rule is out of the market the money sits in cash earning 0%. Buy and hold is shown over the same dates and pays the 0.1% once, on entry. The test window here starts on 1 Feb 2021, the first date with a full band, and ends on 30 Sep 2026: 1,399 sessions, 5.66 years.
Read one more paragraph, 63 words
Over those same dates, holding the index from the first day to the last gave a CAGR of 8.45% with a maximum drawdown of -17.23%. That is the line every rule below is measured against. Maximum drawdown is the deepest fall from a previous peak in the value of the account. Time in the market is the share of sessions with money invested.
Rule one: touch reversion
The first idea is that a close below the lower band is stretched too far and tends to snap back toward the average. Written as a rule:
Exit: close above Middle
Otherwise: cash at 0%
Long only, one position
| 1 Feb 2021 to 30 Sep 2026 | CAGR | Max drawdown | In market |
|---|---|---|---|
| Buy and hold | 8.45% | -17.23% | 100.0% |
| R1 touch reversion, 53 trades | 5.45% | -9.83% | 19.4% |

Test script for this module. Nifty 50 price index, 0.1% per side, cash at 0%. Buy and hold pays the 0.1% once.
Read 4 more paragraphs, 383 words
Before the full rule, a plain count helps. On sessions where the close was below the lower band, the average return over the next 20 sessions was 2.08%, across 59 sessions. On sessions where the close was above the upper band it was 1.21%, across 71 sessions. Across every session in the data the average was 0.72%. These windows overlap, so the counts are sessions and not independent events, and I would not lean on them. They do say that the lower band touches were followed by a slightly better than average month on this data. That is the thing the rule tries to capture.
R1 returned less than holding the index: 5.45% against 8.45% a year. It also had a much shallower worst fall, -9.83% against -17.23%, and it was in the market only 19.4% of the time. Read the two together. Most of the gap in return is simply that the money was in cash for four sessions out of five. A rule that earns 5.45% a year while invested a fifth of the time has not been bad at what it did, but cash at 0% means the rest of the time earned nothing.
The round trips are worth reading because they show the shape of the rule. There were 27 round trips. Twenty two made money and five lost. The average winner was 1.76% and the average loser was -1.61%, and the average trip lasted 10 sessions. The largest gains were 3.36%, on 1 Feb to 3 Feb 2021 and again on 3 Mar to 19 Mar 2025. The worst closed trip was -3.08%, from 4 Mar to 9 Apr 2026. The last trip was still open at the end: entered on 8 Sep 2026 and marked at -4.39% on 30 Sep 2026.
That last trip is the failure mode of a reversion rule. When the index keeps falling, the rule keeps being in it, because the exit is above the middle line and the close never gets there. The winners are small and quick. The losers are the days when the stretch was the start of a move. I read this as a rule with a high hit rate and a thin edge, and 0.1% a side takes a visible bite out of an average winner of 1.76%.
Rule two: breakout
The same bands support the opposite belief. A close above the upper band is not stretched, it is strength, and strength tends to continue. Here is that rule:
Exit: close below Middle
Otherwise: cash at 0%
Long only, one position
| 1 Feb 2021 to 30 Sep 2026 | CAGR | Max drawdown | In market |
|---|---|---|---|
| Buy and hold | 8.45% | -17.23% | 100.0% |
| R2 breakout, 44 trades | -1.87% | -28.62% | 26.0% |
Test script for this module. Nifty 50 price index, 0.1% per side, cash at 0%.
Read 2 more paragraphs, 198 words
R2 lost money: a CAGR of -1.87%, and a maximum drawdown of -28.62% that was far deeper than the index's own -17.23%, even though R2 was in the market only 26.0% of the time. How does a rule that is out of the market three quarters of the time draw down more than the market? By losing small amounts many times. There were 22 round trips. Seven won and fifteen lost. The average winner was 4.66% and the average loser was -2.77%. The winners were bigger than the losers, which is the pattern a breakout rule hopes for, but the losers outnumbered the winners two to one and the win size did not cover it.
The worst stretch is easy to see in the list of trips. From 24 May 2024 to 18 Aug 2026, every one of the 11 round trips lost money, one after another, ranging from -1.55% to -5.28%. The biggest was -5.28%, from 21 Mar to 7 Apr 2025. The biggest winners were 9.30% (11 Jul to 30 Aug 2022) and 8.59% (4 Aug to 4 Oct 2021). Two good trips in 2021 and 2022 were not enough to pay for what came after.
Same indicator, opposite rules
It is worth stopping on this. R1 and R2 use the same three lines and opposite beliefs. R1 enters below the lower band because it expects a return to the average. R2 enters above the upper band because it expects a continuation. On this index and these dates, R1 gave 5.45% and R2 gave -1.87%. If I told you only the first, you might conclude that touches of the band are a reversal signal. If I told you only the second, you might conclude that band breakouts do not work.
Two terms to hold on to from 23.5
Read 2 more paragraphs, 125 words
Both statements would be about this one sample. Different markets and different stretches have favoured one side or the other, and which one depends largely on whether the market was trending or ranging while you tested. An indicator by itself does not carry a direction. The direction comes from the rule you put around it, and the rule is a hypothesis about how prices behave after the signal. That is why I insist on writing the rule down before looking at the result, and on reporting both sides.
The Bollinger band is also not unique in this. The same ambiguity runs through RSI, covered in module 23.4, and through moving averages in module 23.2. An indicator is a measuring stick, not a prediction.
A volatility target as a contrast
The first two rules use volatility to decide when to be in. A third idea uses it to decide how much. This is the volatility target: instead of full exposure or none, hold less of the index when recent volatility is high and more when it is low, aiming at a steady level of risk. The weight is the target volatility divided by the recent volatility, capped at 100% because this test has no leverage. The part that is not invested is held in cash at 0%.
returns x sqrt(252)
Weight = min(1, 10% / Vol)
Trade only if the weight
moves by over 10 points
| 1 Feb 2021 to 30 Sep 2026 | CAGR | Max drawdown | Average weight |
|---|---|---|---|
| Buy and hold | 8.45% | -17.23% | 100.0% |
| R3 volatility target 10%, 88 trades | 5.52% | -13.96% | 80.5% |
Test script for this module. Nifty 50 price index, 0.1% per side on value traded, cash at 0%. Average weight is the "time in market" figure the script prints, since the weight varies.
Read 4 more paragraphs, 330 words
A worked step. If the last 20 days had an annualised volatility of 20%, the weight would be 10% divided by 20%, which is 0.5: half the account in the index, half in cash. If volatility were 8%, the formula gives 1.25, and the cap holds it at 1.00. The 10 point band keeps the rule from trading a sliver every day.
R3 held on average 80.5% of the account in the index and earned 5.52% a year against 8.45% for holding the whole index. Its worst fall was -13.96%, shallower than the index's -17.23%. The volatility of its daily returns, annualised, was 10.34% against 13.92% for the index. The 88 trades cost 0.018 of the starting value over the window.
So the target did what it says. It ran less risk and got less return. It did not beat holding the index on return here, and its drawdown gain was modest. This is the honest version of a common sales line. A volatility target changes the risk you carry. Whether it improves the return you earn for that risk is a separate question that depends on the data.
The research on this is mixed. Moreira and Muir (2017) studied portfolios that scale back exposure when volatility rises and reported higher Sharpe ratios for the market and several factors in US equities and in the currency carry trade. Harvey and co-authors (2018) studied more than 60 assets with daily data from 1926 and found higher Sharpe ratios with volatility scaling for equities and credit, with negligible impact for bonds, currencies and commodities, and a lower chance of extreme returns across asset classes. A later study by Cederburg, O'Doherty, Wang and Yan (2020), across 103 equity strategies, found that volatility managed portfolios do not reliably beat their unmanaged counterparts in direct, real time comparisons. All three are about other markets and much longer samples than the one here. They are the reason I treat the effect as plausible and not settled.

How sensitive is the target?
A good habit with any parameter is to show every value you tried, not only the one that looks strongest. I ran four targets on the same data. Here they are, none dropped:
| Target volatility | CAGR | Max drawdown | Trades |
|---|---|---|---|
| 8% | 4.70% | -11.73% | 99 |
| 10% | 5.52% | -13.96% | 88 |
| 12% | 5.14% | -17.71% | 58 |
| 15% | 6.57% | -17.05% | 35 |
Test script for this module. Nifty 50 price index, 1 Feb 2021 to 30 Sep 2026, 0.1% per side. Buy and hold: 8.45% and -17.23%.
Read 2 more paragraphs, 160 words
The pattern is what you would expect. A lower target means more trades, a shallower drawdown and a smaller return. A higher target holds the index more of the time, so it moves toward the index's own record. The 12% row has a deeper drawdown than the 15% row, a reminder that a tuned number can be noisy: nothing in the formula says drawdown must fall smoothly as the target rises. I used 10% as the headline because it is a round number, and I show the others so you can see how much the answer depends on it.
The range of volatility itself is useful context. The 20 day annualised volatility of the index was as low as 5.0% on 9 Jul 2024, had a median of 11.6%, and reached 30.0% on 14 Mar 2022. A target of 10% leaves the account fully invested on the quiet days and cuts it to about a third on a 30% day.
Where band rules break
Collecting what the tests showed, here are the specific ways a band rule goes wrong.
- Walking the band. In a strong move the close can stay at or beyond the outer line for many sessions. A reversion rule sits in a falling market. A breakout rule exits when the close drops below the middle line, which in a fast trend is a long way behind.
- The bands follow volatility. A rare, sudden jump lifts the standard deviation at once, so the band widens just after the big day and the touch that looked meaningful is no longer outside.
- Price, not returns. The bands measure the spread of prices around an average. In a market that trends steadily upward, that spread can be wide even if daily returns are calm.
- Close only. The test uses daily closes. Bands drawn on intraday highs and lows can touch where the close does not, so a chart reading and a test on closes will disagree.
- Settings. 20 and 2 are conventions. Another length or width is another rule, with its own result and its own place in the tally of things tried.
Where this section sits in module 23.5
What this test cannot tell you
This sample is five and three quarter years, from 1 Jan 2021 to 30 Sep 2026, and it contains one set of market conditions. The number of independent events is small: R1 made 27 round trips and R2 made 22. A different five years could reverse the order of R1 and R2, and nothing here argues against that.
Read 2 more paragraphs, 139 words
The script evaluated six configurations on this data: R1, R2 and the four volatility targets. That number is small, and I am telling you it so that you can see the size of the search. The more variants you test on one history, the more likely it is that one of them looks good by chance. The papers I list on data snooping, Halbert White (2000) and Bailey and others (2014), are about exactly this, and module 23.8 returns to it with a walk forward test.
Costs also matter. The 0.1% a side is an illustration. A real account pays brokerage, exchange charges, securities transaction tax on delivery trades and a spread, and the sum depends on size and how you trade. R1's winners averaged 1.76%, so doubling the assumed cost would take away a visible share of them.
Where this meets how RupeeCase works
The reason I write rules this way is the same reason RupeeCase publishes its strategy rules: a rule you can state in a few lines, with its entry, exit, sizing and costs, can be tested by anyone with the data. A band touch you saw on a chart cannot. In my 17 years in quantitative trading, the habit I rely on most is writing the rule before looking at the result, then reporting the result whichever way it falls.
Read one more paragraph, 59 words
For the risk side, module 2.3 explains the drawdown and volatility numbers used here, module 4.2 covers position sizing in general, and module 3.4 looks at the low volatility factor, which sorts stocks by volatility and is a different thing from sizing an index by it. The drawdown recovery calculator shows what a given fall needs to get back.
Common mistakes
- Reading a touch as a signal. A close below the lower band is a fact about the last 20 days. It becomes a signal only when a rule says what to do next and a test says what happened.
- Testing one direction. Reversion and breakout are opposite uses of the same lines. Test both, report both.
- Ignoring time in the market. A rule in the market 19.4% of the time is not comparable with one that is in 100% unless you say what it earned the rest of the time. Here it earned 0%.
- Dropping the parameters that did not work. Show every length, width or target you tried.
- Treating a volatility target as a return booster. On this data it lowered both risk and return.
- Forgetting costs. Small average winners, like 1.76%, are the most exposed to them.

What I'd keep from this
- Bollinger bands are a 20 close average with lines two standard deviations above and below. The width is a picture of recent volatility.
- On the Nifty 50, closes fell outside the bands on about 5% of sessions each side, against 2.3% for a bell curve. Band width ranged from 1.51% to 15.31%.
- Over 1 Feb 2021 to 30 Sep 2026, holding the index gave 8.45% a year with a -17.23% drawdown. Touch reversion gave 5.45% and -9.83% in the market 19.4% of the time. Breakout gave -1.87% and -28.62%. A 10% volatility target gave 5.52% and -13.96%.
- Two of the three rules did worse than holding the index on return, and the volatility target cut risk and return together.
- The sample is short and one regime. Treat each figure as one test, and count the variants you ran.
Questions readers ask
What do the two lines around a Bollinger band mean?
They sit two standard deviations above and below the 20 close average. Their distance from the average is a measure of how much the last 20 closes scattered. A wide band means volatile recent prices, a narrow band means calm ones.
Is a close below the lower band a reason to expect a rise?
Not by itself. On the Nifty 50 between Feb 2021 and Sep 2026, a touch rule did better than average in the following month, but it earned less than holding the index and the sample is short. A close outside the band is a fact. Whether it carries information is what a test of an exact rule is for.
Why can the same indicator give a reversal rule and a breakout rule?
Because the indicator only measures. The direction comes from the belief you attach to it: that stretched prices return, or that strength continues. Each belief is a different rule and gets its own test.
Does volatility targeting always improve returns?
No. It aims to hold risk steady. Published studies find higher risk adjusted returns for equities in long samples, and a later study found that managed portfolios do not reliably beat unmanaged ones in real time comparisons. On the Nifty 50 data used here, it lowered return and drawdown together.

Rules and figures in this module were last verified on 27 Nov 2026. Tax and regulatory rules change; check the source before acting.
