19th Ave New York, NY 95822, USA

Backtesting Bollinger Bands On ETFs And Stocks – Full Strategy And Results


I have recently been looking at some old materials and I came across another interesting work by Larry Connors and Cesar Alvarez regarding Bollinger Bands.

Bollinger Bands were developed by John Bollinger and can be used in a number of different ways. In this article, we will use Bollinger Bands to find mean reversion trades.

Backtesting Bollinger Bands

As I said in a previous blog about classic trading books, I always like going over old material because you’re given a large window of out of sample data for evaluation.

If a book talks about a trading strategy and is published in 2010, for example, you then have 7+ years of data to see how it got on.

In their guidebook on Bollinger Bands, Connors and Alvarez present a number of different strategies and they show impressive quantified results between 2006 – 2012.

(Most of the strategies show win rates above 75% with some even higher than 90%).

Their strategies are designed to find pullbacks in ETFs and the rules are all based on an indicator called %b which is derived from the Bollinger Bands calculation.

The %b Indicator

The %b value is used to quantify a security’s price in relation to the upper and lower Bollinger Band and can be calculated with the following formula:

%b = (Price ‐ Lower Band) / (Upper Band ‐ Lower Band)

When %b is greater than 1, it means price is above the upper band and when %b is less than zero it means price is below the lower band.

Instead of the standard Bollinger Band configuration of a 15 period moving average with two standard deviations, Connors and Alvarez like to use a 5-period MA.

They determine the standard deviation of the price over the same number of periods which in this case is five. We are given the following formula:

Upper Band = MA(5) + SD(5)
Lower Band = MA(5) – SD(5)

According to Connors, the ‘%b component of Bollinger Bands allows you to better pinpoint proper entry and exit triggers’.

They also like the %b value to be under 0.3 for multiple days in a row. The lower the reading, the more oversold the security and therefore the greater the chance of a profitable pullback trade.

Strategy Rules

As mentioned, the guidebook details a number of strategies based on %b but they are all variations on the same theme.

For the purposes of this article, I will be testing just one variation which I picked at random. The strategy is designed for ETFs and the rules are as follows:

Buy Rules

  • The 21-day average volume of the ETF must be greater than 125,000.
  • The lowest daily volume of the ETF over the last 21 days must be greater than 50,000.
  • The closing price of the ETF must be above it’s 200-day moving average.
  • The %b value must be under  -0.1 for four days in a row.

Sell Rules

  • Sell when %b goes above 1.

Rules In Plain Language & Trade Example

In other words to implement this strategy we have some liquidity rules and some price action rules.

We need the ETF to have sufficient volume so that we can trade it easily and we need the %b to be under -0.1 for four days in a row so that we can be sure the security is very oversold.

We then sell when %b climbs above 1, hopefully giving us a quick, profitable swing trade.

Following is an example of the trade setup we are looking for in the iShares Japan ETF (EWJ):

EWJ meets the volume criteria first of all with millions of shares traded.

On the 29th July, the %b value (middle pane) has been under -0.1 for four days in a row. We therefore enter long on the next open (green arrow).

The %b value then crosses above 1 on the 1st August and so we close the trade on the next open for a profit of 2.78% in 4 days (red arrow).

Backtest Settings & Issues

Although the strategy guidebook does a good job of explaining the rules there are a few issues that we should address before we look at the results shown in the book.

The first issue is that the results assume trading on the close of the trading signal. While this may not always be a major problem I feel it is quite difficult for traders to do this, since the %b and 200-day moving average values require close values in order to be plotted.

Therefore our backtest will enter trades with a one bar delay. That is, we will enter and exit on the next day open instead of the same day close.

The second issue is that the guidebook gives no detail as to which ETFs are used in the simulation.

This is a bit of a problem because it means I have been unable to replicate the results in the guidebook.

I did try testing on the same watchlist of 20 ETFs that was described in another one of Connors’s products but my backtest only resulted in 63 trades. Connors results show over 400 trades for this strategy so he must be using a much wider universe of ETFs.

Because of this, I will use my own watchlist containing of 45 liquid ETFs and stocks.

Finally, Connors provides no information regarding transaction costs. We will use a position size of $1,000 per trade and assume transaction costs of $0.01 per share.

Backtest Results

The following table shows Connors results as recorded in the guidebook compared to our results for the backtest period between 1/2006 – 8/2012.

backtesting bollinger bands trading strategy results

As you can see, there are some differences in the two results.

We have recorded fewer trades overall. This was expected because we do not know what ETFs Connors has used.

The average profit per trade is quite a lot lower but the win rate is above 75% and is pretty good.

Connors does not provide details about drawdowns but we recorded a CAR/MDD of 0.47 which is also pretty good.

Following is an equity curve that shows how profits accumulated during our backtest:

bollinger bands system equity curve

Out-Of-Sample Results

Since this guidebook was published in August 2012 we now have over five years of data with which to evaluate this system.

Following shows the results and equity curve when we apply this same system to the watchlist of 45 stocks and ETFs during the out-of-sample period between 9/2012 – 9/2017.

backtesting bollinger bands trading strategy results two

backtesting bollinger bands on etfs and stocks out of sample equity curve

As you can see, this system has performed quite well in the time period since publication. Although our profit per trade and win rate has decreased slightly we have not encountered much of a drawdown and our CAR/MDD has gone up to 0.51

Putting It Together

Now that we have seen there might be a possibility of a profitable edge using this Bollinger Band signal we can go one step further and put it all together as a portfolio simulation.

The following results and equity curve show the performance of a $100,000 portfolio between 1/2006 – 9/2017. The maximum number of open positions is capped at 10 with equal weighting position size (i.e. 10% per trade).

If we get more signals than the portfolio can carry we will prefer the ETF with lower %b.

  • Net Profit: $87,557
  • Annualised Return: 5.54%
  • Maximum Drawdown: -12.19%
  • CAR/MDD: 0.45
  • Win Rate: 65.3%
  • Exposure: 27.68%
  • Risk Adjusted Return: 20.02%
  • Profit Factor: 1.41

bollinger bands portfolio strategy

As you can see, the annualised return when traded as portfolio is not particularly strong at 5.54%. However, it is balanced by a modest drawdown, giving a CAR/MDD of 0.47.

The win rate is OK at 65% and exposure is also reasonable. However, one worrying feature is that the system has basically flat-lined since 2015.

Update 9/1/2017

In response to Marco’s comment below, I have just back-tested the same system as above but this time I have used the open price instead of the close price for all of the calculations. This ensures we can trade on the close and not have to wait for the next open.

Results are significantly better. CAR: 7.31%, MDD: -9.59%, CAR/MDD: 0.76, WR: 72.28%.

portfolio with open prices

Final Thoughts

It is always good to look over old materials to find interesting strategies that you can test on unseen data.

In this article, we found an interesting Bollinger Bands strategy that worked pretty well on our selection of ETFs and stocks and shows a fairly high win rate.

Although it hit a bad patch after 2015, this system has some good characteristics and could be worth investigating further.

Amibroker Code

Following is a snippet of Amibroker AFL to show how we constructed the formula:

// Entry/exit rules. For educational purposes only. Full disclaimer applies.

Liquid = MA(V,21)>125000 AND LLV(V,21)>50000;	

UpperBand = MA(C,5) + StDev(C,5);
LowerBand = MA(C,5) - StDev(C,5);
PercentB = (C - LowerBand) / (UpperBand - LowerBand);
PercentB1 = Ref(PercentB,-1);
PercentB2 = Ref(PercentB,-2);
PercentB3 = Ref(PercentB,-3);

BUY = 	PercentB < -0.1 
	AND PercentB1 < -0.1 
	AND PercentB2 < -0.1 
	AND PercentB3 <-0.1 
	AND C>MA(C,200)
	AND Liquid;
SELL =  PercentB > 1;


Simulations and charts in this article produced with Amibroker using historical data from Norgate.

Comments (13)

Hello John,

have You tried to run the back-test using the Open prices for the %b, in such a way You don’t need to delay the entries and (much more importantly, IMHO) the exits ???

Good idea. I just tried it and the results improve significantly. CAR: 7.3, MDD: -9.6, WR: 72.3
Thanks for the suggestion.

To be honest was just Your idea. I had read recently your Free Trading System rules page. Regards, Marco

Well you reminded me 🙂

100k sitting around for 5yrs and you think making $500 is actually OK?
I’ve read your work with interest for some years but you didn’t see the forest for the trees on this one!

Sorry for the confusion but the equity curve is a function of the position size. I used a fixed position size of $1000 in order to cover every trade signal during the backtest. The equity level is therefore misleading but I showed it so we can see a timeline of profits. The return when risk-adjusted is actually good and I will update the article to reflect this.

Thanks for sharing! I’ve been looking at adding. mean reversion strategy to diversify my main trend following systems. This could be an interesting starting point!

Thanks for sharing that JB. I like your style. And, Marco, great question/suggestion and JB great answer. Regarding trade entry on stocks/ETF’s etc on daily timeframe I also have been using a live trade selection filter and placing trades in the last 15 minutes of the trading day based on the anticipated close; working much better than waiting for the following day open.

Couple of questions. I don’t know Amibroker AFL. For my clarity…. Is MA(C,5) an SMA? Is SD(C, 5) one SD of SMA(5) or a ‘default’ of 2 SD?

In backtesting, have you tried on other periods, i.e 7, 9, 10, ubiquitous 14 etc?

Regards, John

Hi John, yes MA is the simple moving average. SD(5) written as StDev(C,5) I believe is the one standard deviation of the last 5 closes.

I’ve not really tried this strategy with any other settings than what was in the book. These strategies tend to work best with short look backs so I don’t think 14 would work well but can give it a try.

Thanks for clarifying JB.
If I get a bit of time spare in the next week or two, I will give it a backtest on another platform as well and see what transpires.
Regards John

Sounds good, let us know what you find. Cheers

So, there is no stop-loss, right?
Could you also please try the same backtest on S&P500 stocks?

Thanks for sharing anyway!


Yes, no stop-loss. Alright, I can try it on the S&P 500. I suspect the drawdown will increase.

Leave a comment