The Bollinger Bands squeeze is a common signal of an upcoming breakout.
In this post, I’ll introduce the Bollinger Bands Width Ratio indicator, and use it to program a breakout strategy for the AUDJPY.
You can download the complete strategy in the Free Strategies section.
Bollinger Bands are the ever-popular indicator for trend following and mean reversion traders alike.
StrategyQuant provides a Bollinger Bands Width Ratio (BBWR) indicator, which measures the width between the upper and lower bands.
With this indicator, you can detect a Bollinger Bands squeeze and prepare for a potential breakout.
But first, here’s a quick primer on Bollinger Bands and what they signify.
Bollinger Bands and Volatility Cycles
Bollinger Bands consist of a 20-period simple moving average surrounded by a pair of upper and lower bands. These bands are placed at 2 standard deviations above/below the moving average.
In the chart below, you can see how the bands elegantly convey market volatility and trend direction.
The rising moving average indicates an uptrend, while the band width measures market volatility.
Market volatility is often cyclical in nature. Volatility is high when the market trends, and subsequently falls when prices consolidate. The Bollinger Bands therefore alternate between periods of expansion and contraction.
Bollinger Bands Width Ratio Indicator
The BBWR indicator is not available in MT4 by default, but you can download it here.
It quantifies the expansion and contraction of the Bollinger Bands. It uses the following simple calculation:
Here’s the BBWR plotted below prices in MT4:
Small BBWR values indicate a Bollinger Bands squeeze. Reduced volatility often happens before major economic announcements, where the vast majority of market participants wait on the sidelines, ready to jump onboard a trend should a breakout occur.
Large BBWR values indicate strong market trends. Sudden spikes in BBWR indicate a parabolic market move, which often spells the impending end of a trend.
Exploiting the Bollinger Bands Squeeze
Let’s program a Bollinger Bands squeeze breakout strategy for the 1-hour AUDJPY.
The idea is to use a 30-period BBWR to detect a squeeze, which could signal an upcoming breakout.
Quantifying a visual pattern is always a challenge in algorithmic trading.
In this case, I’ll define a squeeze as the BBWR reaching its lowest level in 60 periods.
To improve the win rate, I’ll only take breakouts in the direction of the longer-term trend.
I’ll use a simple momentum filter to determine trend direction. An uptrend is present if the current close is above the close 50 periods ago.
If this squeeze occurs during an uptrend, I’ll place a buy stop at the prior day’s high.
Here’s how a long entry looks:
I’ll use a 70-pip initial stop loss and trailing stop. I find this simple combination works surprisingly well for trend following strategies.
AlgoWizard Programming
Here are the simple entry conditions in AlgoWizard:
Note that there are two different lookback periods in use for the BBWR condition.
‘BB_Period’ is the lookback period for the BBWR itself, which is set to 30.
‘BBWR_Lookback’ is the period used to determine the minimum BBWR value, which is 60.
Stop entries and trade management are programmed as follows:
‘HighD[1]’ refers to the previous day’s high.
Backtesting the Bollinger Bands Squeeze Strategy
It’s easy to cherry pick a handful of spectacular trades from any strategy.
To combat this, I always backtest my strategies over the long-term.
Here’s a 10-year backtest of the BBWR breakout strategy on the 1-hour AUDJPY.
I redid the backtest using MT4’s backtest engine and the statistics are similar:
Getting similar results using different backtest engines and data sources (Dukascopy vs. Alpari) gives me confidence that the strategy has an edge.
Wrapping Up
The BBWR indicator is a great way to quantify the expansion and contraction of the Bollinger Bands.
Small BBWR values indicate a band squeeze, which usually occurs before a breakout.
Abnormally large values reflect a parabolic market move, which can spell the end of a trend.
If you prefer using the Bollinger Bands for mean reversion instead, here’s how you can combine them with candlestick patterns.
You can download the complete strategy in the Free Strategies section.
0 Comments