Bollinger Bands strategy: rules and how to test them
By Oalgo · Last reviewed
A Bollinger Bands strategy uses the two bands around a 20-period average. The band-touch rule enters when the close falls below the lower band and exits near the middle band. The squeeze rule watches for the bands to narrow, then acts when price moves out of them.
What are the rules of a Bollinger Bands strategy?
#- Band touch, entry: the close falls below the lower band.
- Band touch, exit: the close rises back to the middle band.
- Squeeze, entry: the bands have narrowed, which means price has been quiet, and then the close rises above the upper band.
- Stop: a Stop Loss as a percentage, because price can keep falling after it touches the lower band.
How do you write this strategy in Oalgo?
#In Oalgo you can tell Oalgo AI your Bollinger Bands rule in your own words, check the rule it builds, and test it. After testing, if you choose, you Go Live with your own Live Strategy on your own Venue Account at a Supported Venue.
For example, you could tell Oalgo AI: "Enter when the close falls below the lower Bollinger Band (20, 2). Exit when the close rises above the middle band. Use a 1% Stop Loss and a 2% exit target." These numbers are examples to change. A Live Strategy needs a stop on each side it can enter, and an exit target is optional. The example names both.
A squeeze has no single definition, so you choose one. In the builder a Math block can subtract the lower band from the upper band, and a condition can compare the result with a number you set.
How do you test this strategy honestly?
#- Run a backtest on a trending range and on a sideways range. Band touches mean different things in each.
- Check the fees and the number of trades.
- Try nearby settings, for example 18 or 22 candles, and 1.5 or 2.5 deviations. A rule that only holds at one exact setting may be fitted to the past.
- Run a forward test on new prices, with simulated funds.
What can a Bollinger Bands strategy not tell you?
#A touch of a band is not a turn. In a strong move price can stay at or beyond a band for many candles. A squeeze says price has been quiet. It does not say which way price will move next, so a squeeze rule needs a second condition, and that adds another setting. The RSI strategy page covers a similar rule on a different scale.
Read next
- Bollinger Bands explained: how to read and use themBollinger Bands sit above and below a moving average and widen when price moves more. Learn how they are calculated, how to read them and how to test rules.
- RSI strategy: oversold and overbought rules, explainedAn RSI strategy enters when RSI falls below a low level such as 30 and exits as it recovers. See the rules, their weakness in a trend, and how to test them.