Do Bollinger Bands + Candlestick Patterns Work?

Jan 12, 2021

Bollinger Bands are great at detecting overbought and oversold conditions. Let’s use them to develop a countertrend strategy, and then refine our entries using limit entries and candlestick patterns.
The complete strategy can be downloaded in the Free Strategies section.

A Bollinger Bands Primer

Bollinger Bands are one of the marvels of technical trading. They consist of a simple moving average surrounded by a pair of upper and lower bands. These bands are placed at a certain standard deviation multiple above and below the moving average.

Bollinger Bands are typically defined by two parameters – the moving average lookback period, and the standard deviation multiple. By default, a 20-period lookback and a standard deviation multiple of 2 are used.

If prices followed a normal distribution, they would fall within the bands 95% of the time. In reality, however, the presence of the occasional price surge brings the percentage closer to the 85-90% range.

Since the upper and lower bands are based on standard deviation, the Bollinger Bands provide a graphical representation of market volatility. High volatility causes the bands to expand, while low volatility causes them to contract, or ‘squeeze’.

Like most indicators, Bollinger Bands can be used in both a trend and countertrend manner. I previously discussed the development of a Bollinger Band trend following strategy that performed pretty well on the GBPJPY.

Let’s go countertrend this time.

Bollinger Bands and Countertrend Trading

Since prices remain within the bands most of the time, the market is considered overbought when prices close above the upper band, and oversold when prices close below the lower band.

In countertrend trading, we are speculating that prices will return to the mean after a temporary overextension. Overbought conditions present good opportunities to short the market, while oversold conditions are great for longs.

We want to react quickly to capture the overbought/oversold conditions when they occur. A short lookback period is required here. The default lookback of 20 should do fine.

The standard deviation multiple is an important parameter has a large influence on the number of trades. Ideally, we want to filter out as many false signals as possible, yet obtain a significant number of trades. Bollinger Bands with standard deviation multiples of 2, 2.5, and 3 are plotted below.

When a multiple of 3 is used, it seems prices rarely penetrate the bands even when the market is trending. Let’s stick with the default multiple of 2 for now. It can be optimized later if needed.

What Market and Timeframe?

An important consideration for any strategy is the choice of market and timeframe.

Although the goal is to develop a robust strategy that performs well over different markets, it makes no sense to develop a countertrend strategy for a traditionally trending market. We need a mostly range-bound market.

When selecting a market, it pays to think about the fundamental characteristics of the currency. We want currencies that are highly correlated, such that they will usually move in tandem with each other.

AUDNZD immediately comes to mind. The Australian and New Zealand dollar hail from the same geographical area and are both risk-on, commodity-based currencies. Moreover, both countries have China as their biggest trading partner. Any change in China’s economic fortunes will affect both currencies significantly.

We’ll give AUDNZD a go here.

How about timeframe? Since we want to fade the market, we are betting that the price extension was a result of random market noise. Since lower timeframes generally exhibit higher levels of noise, let’s try the 15-minute timeframe.

If you suspect the price movement is caused by fundamental factors such as economic reports or central bank decisions, it’s probably best not to adopt a countertrend strategy for the time being.

Trading Strategy Logic

For starters, we’ll try the following simple rules:

Buy when prices close below the lower Bollinger Band
Sell when prices close above the upper Bollinger Band

Market orders will be used for entry. How about trade management?

There’s a pretty good chance that prices will soon return to the mean after being overbought/oversold, so let’s use a larger stop loss distance to give the trade more breathing space.

Realistically, we can only expect prices to return to the ‘average’ value. We won’t be capturing a large number of pips per trade like trend following strategies do.

So let’s have a profit target that is half that of our stop loss. The high win rate should make us profitable.

We’ll just plug in a 60-pip profit target and a 120-pip stop loss.

Let’s test!

Results of Our Bollinger Bands Starter Strategy

The strategy was programmed with AlgoWizard. If you’re looking for a visual strategy builder, and don’t fancy learning programming, check out my step-by-step guide on creating a strategy in AlgoWizard.

The backtest used 1-minute AUDNZD data over the past 10 years.

Wow! That didn’t go according to plan. We have a healthy sample of 811 trades, but only 65% were winning. I expect a higher win rate for countertrend strategies.

I suspect too many false signals were captured. In other words, after entering the trade, prices continued to diverge from the mean. To improve the strategy, we’ll try to:

  1. Get a better entry price using limit orders
  2. Add a candlestick pattern filter to reject false signals

Entering With Limit Orders

A limit order allows you to enter the market at a specific price or better. For longs, you can place a buy limit below the market price. Your order will be filled if prices fall. For shorts, the sell limit would be above the market price.

Apart from giving you a more favourable price, entering on a limit order increases the likelihood of catching a price rebound. Think of stretching a rubber band. The further you stretch it, the more forcefully it rebounds. Of course, sometimes the rubber band breaks, in which case the prices start trending.

What price should we use for the limit orders? A simple option would be to use the previous candle’s low for the buy limit, and the previous candle’s high for the sell limit.

You also need to specify a validity period for limit orders. If the overbought/oversold condition is a result of random noise, the rebound towards the mean should occur shortly. A 3-bar validity period seems appropriate.

The entry actions in AlgoWizard were modified as follows:

Now let’s redo the backtest.

I’m surprised at how much results have improved.

I’m also surprised that both strategies have a similar number of trades (811 vs. 810). It is unlikely that practically every limit order was triggered within 3 bars. Surely the two strategies used different entry signals?

To be sure, I combined both strategies into a portfolio and measured the correlation of their daily profits/losses. The correlation coefficient was fairly low at 0.37, implying that different entry signals were used (fortunately).

The average size of winners and losers are also similar, since the stop loss and take profit levels were unchanged.

So it seems the improvement in performance is purely down to the higher win rate of 69%.

Not bad, but we’re not done yet. 69% is still too low for my liking. Fortunately, with 810 trades, we can afford to be picky and add some entry filters.

Adding a Candlestick Pattern Entry Filter

Candlestick patterns help traders discern the dynamics between buyers and sellers.

Since our countertrend strategy bets on prices reversing back towards the mean, let’s consider the four popular reversal candlestick patterns below.

1. Doji

A Doji is a candlestick with a narrow body, accompanied by long shadows at both ends. After reaching an overbought/oversold condition, this indecision in the market could signal an upcoming reversal.

Dojis can be either bullish or bearish signals, depending on the preceding price action.

2. Hammer/Shooting Star

A hammer is a bullish reversal candlestick, consisting of a small body and a long lower shadow. Prices initially head lower, but buyers eventually overcome sellers, pushing prices back up towards the open.

The shooting star is the opposite of the hammer, and signals a possible bearish reversal.

3. Bullish/Bearish Engulfing

A bullish engulfing is a two-candlestick pattern. A small bearish candle is followed by a large bullish candle, whose body completely engulfs the body of the first candle. This could signal a powerful bullish reversal.

Bearish engulfings are the opposite.

4. Piercing Pattern/Dark Cloud Cover

These could be considered less potent versions of the engulfing candlestick patterns.

In the Piercing Pattern, a bearish candle is followed by bullish candle that gaps lower at the open. This bullish candle eventually closes above the midpoint of the bearish candle, signalling a possible bullish reversal.

The Dark Cloud Cover is the opposite.

In general, the more candlesticks a pattern contains, the more reliable it is. For example, bullish engulfings are generally more reliable than hammers.

Regardless of the candlestick pattern you use, it’s also a good idea to examine the preceding candles. Reversal candlestick patterns that occur after prolonged uptrends/downtrends are more reliable.

Programming the Candlestick Patterns

To get more trades, our entry filter will pass if any one of the above four candlestick patterns is present. The ‘or‘ operator will thus be used to link the candlestick pattern conditions.

The candlestick patterns will be added to the upper/lower Bollinger Band penetration conditions. This means entry signals will only be generated when prices penetrate the upper/lower bands and one of the above candlestick patterns is present.

Fortunately, these candlestick patterns are already pre-programmed in AlgoWizard. You won’t have to manually define a pattern by quantifying the OHLC relationships between the candles.

The AlgoWizard entry conditions were updated as follows:

Final Results

With limit entry orders and candlestick filters, our backtest results look much better.

By focusing on high probability reversal setups, the candlestick pattern filter rejected half of the original 810 trades.

The win rate is up to 72%, and the resulting 1.26 profit factor is far more palatable.

A cursory glance at the Trade analysis tab in AlgoWizard reveals that the strategy was profitable on all weekdays except Monday.

Trading volumes are typically lower on Mondays. Countertrend strategies tend to perform better in quiet markets, so this result is a little surprising.

It’s easy to add a day-of-the-week entry filter, but that’d be like putting one foot into the curve fitting pond, so I’ll keep the strategy as it is.

If you wish to add it, you just need to add the entry condition below:

Let’s Talk Backtest Precision

When backtesting, there is always a trade-off between precision and time requirements. Are the preceding backtests precise enough?

To save time, all the above results were obtained using a simplified backtest model. In this model,

  • Strategy logic is only evaluated at the opening of each bar
  • Only the OHLC prices of the completed bars are considered

If your strategy often executes trading actions in the middle of a bar, this simplified backtest model could produce inaccurate results.

Our strategy’s 60-pip profit target and 120-pip stop loss are always in the market, so they could be triggered anytime. But the average bar range of the M15 AUDNZD is usually below 20 pips, so the inaccuracies should not be too severe.

Regardless, let’s go ahead and verify our backtest results with tick data.

To find out whether you need a tick backtest, and where to get quality tick data, head over to my article on tick backtesting.

Performing a Tick Backtest

I used Tickstory tick data and reran the final backtest over the past 10 years.

You should get 0 mismatched charts errors and a 99.90% modelling quality.

Pertinent metrics such as the total trades and expectancy are very similar (~3% discrepancy). Most importantly, the equity curves look similar.

In addition, I can be more confident that the backtests are reliable since both the AlgoWizard and MT4 backtest engine produced similar results.

Nonetheless, it is unlikely that any backtest engine can perfectly model the filling of limit orders. In live trading, liquidity issues may mean that only part of your order will be executed at the limit price. If you are serious about using limit orders, it’s recommended to do some forward testing under real market conditions.

Wrapping Up

So a simple Bollinger Bands strategy augmented with candlestick patterns can indeed work!

Some market research will help you select an appropriate market for the above strategy. You probably should avoid volatile, trendy markets!

Unfortunately, the strategy doesn’t trade much; there were only 3 trades/month over the past 10 years. To get more trades, you can add in more candlestick patterns, including those containing 3 candles.

If you want to play around with the complete strategy, you know where to find it.

Powered By

Development Platform

Forex VPS

FXVM Forex VPS

Popular Posts

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

read more

What is Fixed Ratio Money Management?

Have you heard of fixed ratio money management? How does it compare to the popular fixed fractional approach? Here I’ll explain how fixed ratio works, and see how it stacks up against fixed fractional money management.

read more

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

read more

What Is the QQE Indicator?

The QQE is a mysterious indicator that sometimes pops up in trading forums. Does it deserve a place alongside the more traditional momentum indicators like the RSI and CCI? Let’s add it to a trend following strategy to find out!

read more

Make your money work for you!

Get promotions, trading ideas and strategy development tips delivered to your inbox!

Comments

1 Comment

  1. Anonymous

    Good one

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Trading Strategies

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

Forex Weekend Gaps: Can You Exploit Them?

Forex Weekend Gaps: Can You Exploit Them?

Have you noticed that forex weekend gaps usually reverse within 3 days? Here I’ll program a mean reversion strategy to exploit gaps over the last 18 years!

Money Flow Index: An Improved RSI?

Money Flow Index: An Improved RSI?

The Money Flow Index is sometimes called the volume-weighted RSI. Can it outperform the RSI in this trend following strategy?

Automated Bollinger Bands Squeeze Forex Strategy

Automated Bollinger Bands Squeeze Forex Strategy

StrategyQuant’s BBWR indicator is the perfect tool to detect a Bollinger Bands squeeze. Here I explain how it’s calculated, and use it to program a breakout strategy for the AUDJPY!

Should You Use the Kelly Criterion for Forex Trading?

Should You Use the Kelly Criterion for Forex Trading?

The Kelly criterion is a famous mathematical formula that attempts to maximize your long-term capital growth. In this post, I’ll apply it to a EURUSD breakout strategy and explain some of its potential shortcomings when applied to forex trading.

Can a Trading Pause Improve Your Trend Following Results?

Can a Trading Pause Improve Your Trend Following Results?

A temporary trading pause can improve your win rate if you’re trend following a volatile market. Here I’ll program a trading pause into a simple breakout strategy, and test its effectiveness on the Widow Maker – the GBPJPY.

Laguerre RSI Trend Following Strategy

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

How to Use the Supertrend Indicator

How to Use the Supertrend Indicator

Despite its cool name, the Supertrend indicator often seems to slip under the radar. Here I explain how it’s calculated, and combine it with moving averages to produce a simple trend following strategy.

Strategy Development

Do You Know Your System Quality Number?

Do You Know Your System Quality Number?

The System Quality Number measures the profitability & consistency of your trading system. Here’s how to calculate your SQN and use it to improve your trading!

How to Get a Realistic Backtest Spread

How to Get a Realistic Backtest Spread

Your choice of backtest spread can certainly make or break a strategy. This post will show you how to study the intraday spread variations of your market, and suggest several ways to avoid paying ridiculous spreads.

Do You Know Your Strategy’s Optimization Profile?

Do You Know Your Strategy’s Optimization Profile?

Your strategy’s optimization profile often reveals its robustness, helping you select strategies that will remain profitable in live trading. Here I explain why an optimization profile is important, and how you can easily obtain one using StrategyQuant’s optimizer.

Which MT4 Backtest Report Metrics Should You Use?

Which MT4 Backtest Report Metrics Should You Use?

Understanding your backtest report is an essential part of being a successful strategy developer. Here I explain what the numbers mean, and how you can make use of each metric during strategy development.

Out-of-sample Testing Using Monte Carlo Simulations

Out-of-sample Testing Using Monte Carlo Simulations

Traders often use Monte Carlo simulations to estimate worst-case drawdowns, but did you know they can be used for out-of-sample testing too? This post demonstrates the use of StrategyQuant’s Monte Carlo simulator to randomize historical prices and strategy parameters, helping you select robust strategies for live trading.

How Many Trades Should Your Backtest Have?

How Many Trades Should Your Backtest Have?

We all want a large sample of trades in our backtests, but practical limitations such as data availability often get in the way. Here I’ll explain why 30 trades is insufficient, and how you can use standard error to quantify the uncertainty arising from a small sample size.

Build a Diversified Portfolio With QuantAnalyzer

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

Strategy Optimization Using MT4

Strategy Optimization Using MT4

How do you improve your trading strategy in MT4? This post will show you how to optimize the entry and exit parameters for a moving average crossover strategy. Finally, an intraday time filter will be added to help avoid false breakouts.

Debugging & Backtesting Using MT4

Debugging & Backtesting Using MT4

With a fresh algorithm at your fingertips, how do you verify that it has been programmed correctly? This guide will show you how to use Metatrader 4’s visual backtester to debug and backtest your strategy.

Create Your Trading Algorithm in 15 Minutes (FREE)

Create Your Trading Algorithm in 15 Minutes (FREE)

Converting your trading idea into an algorithm is the first step towards reaping the benefits of automated trading. This guide will cover the creation of a simple moving average crossover algorithm, without any actual programming.

What Is Drawdown in Trading?

What Is Drawdown in Trading?

Are you getting a comprehensive assessment of your strategy’s downside? This post will discuss several methods to measure drawdowns, helping you build and select strategies that better suit your risk appetite.

Live Trading

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

How to Find a Real Trading Guru

How to Find a Real Trading Guru

Every day I come across a trading guru offering educational content on the internet. Many of them speak of huge returns with minimal effort. Should these be trusted? Here’s some tips on how to separate the wheat from the chaff.

How to Enjoy Stress-Free Trading

How to Enjoy Stress-Free Trading

Trading is a great way to make some additional income, but not if you’re constantly pulling your hair out. Here I offer 7 tips to help make your trading profitable and stress-free.

How to Select the Best Forex VPS

How to Select the Best Forex VPS

A virtual private server (VPS) is a virtual computer that you can rent and access remotely. It provides a reliable platform on which to execute your forex strategies. This post will help you decide whether you need a VPS, and show you how to select an optimal VPS.

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Pin It on Pinterest

Share This