Bollinger Bands are a technical indicator that visually display the upper and lower range of a security’s normal price movement using standard deviation.
Traders use Bollinger Bands to identify overbought or oversold conditions in a security and potential breakouts from a trading range.
Bollinger Bands are typically drawn 2 standard deviations above and below a 20-day simple moving average. Approximately 95% of a security’s price action should occur inside the upper and lower Bollinger Band.
If you change the default parameters from 2 standard deviations to 1, 68% of price action should occur inside the bands. Widening the band’s parameters from 2 to 3 standard deviations would capture approximately 99% of the expected price range inside the bands.
This guide shows you how to automate buying and selling spreads based on Bollinger Band breakout signals.
While 95% of a security’s price action occurs between the upper and lower band, a breakout can be a significant event. With proper risk management, trading breakouts can be rewarding.
To identify and trade breakouts manually, you must first identify the breakout and then take action. It’s difficult enough to monitor breakouts in a single security, let alone a group of tickers.
Bots scan for breakouts so you don’t have to. Bots can continuously look for breakouts in multiple tickers and automate a trade’s entry when conditions are right.
This bot trades Bollinger Band breakouts with risk-defined credit spreads or debit spreads. You can easily choose to trade the strategy with credit spreads or debit spreads by simply toggling a bot switch.
After you’ve selected the position type, you can define profit targets and build in protection if a profit target is not hit. The bot automatically sends an order to your broker if a profit target triggers.
Automating the strategy
Automating a Bollinger Band breakout strategy allows you to look for breakouts across multiple tickers.
This bot’s scanner automation includes SPY, TLT, GLD, and XOP. The bot uses a symbol loop to check for a Bollinger Band breakout in each ticker. You can always add or remove tickers to the symbol loop.
An opening order is sent to your broker if a breakout is identified.
The bot only trades when you tell it to trade. You can include filters to prevent overtrading. If a position limit is hit, the bot will not trade. Or, if the bot already has a position in the security, it will not open another position.
As you can see in the screenshot below, there is more to this scanner automation. So let’s dive into the specifics of each decision recipe.
The scanner automation first checks to ensure the bot doesn’t already have an open position in each ticker. This prevents the bot from opening multiple positions in a single security.
The bot then checks its position limits to ensure it can open a new position.
Next, the bot checks if the security has broken above the upper or below the lower band intraday with this Bollinger Band decision recipe.
This bot uses the default Bollinger Band inputs of a 20-day simple moving average with 2 standard deviations above and below the SMA.
We’ve also added a bot switch. Switches are a dynamic tool that give you the ability to effectively “turn on” or “turn off” certain parts of an automation, controlling which path the bot takes.
Switches allow you to adapt to market conditions. In this case, the switch tells the bot to open a debit spread or credit spread.
When implied volatility is high, you may want the bot to sell credit spreads. Other times, you may want to buy debit spreads for a more directional move. Automation enables you to use dynamic option orders to open specific strategy types based on the defined criteria.
Your individual technical analysis can help you decide when to turn the switch on or off.
You can label the switch, turn its default value to “On,” and provide a description for easy future reference.
Next, the bot checks for liquidity using a minimum bid/ask spread threshold. Then, the bot confirms there is sufficient open interest for the inside leg of the position.
If all conditions are met, the bot sends an order to the broker to open a position using Option Alpha’s SmartPricing technology.
One of the great things about automation is that it removes human emotion from trade management, especially when exiting a position. You can tell the bot when to take profits, and it will consistently execute without thinking twice.
The bot uses a position loop inside the monitor automation to apply the same exit parameters to each open position.
First, the bot determines if the position is a short credit spread or a long debit spread. Remember, this depends on whether or not you’ve turned the switch “on” or “off.”
For credit spreads, the bot targets a 50% profit. For debit spreads, the bot targets a 25% profit. You can adjust these values based on personal preference and risk tolerance.
If the position’s profit target is met, the bot sends an order to your broker.
If not, there are additional criteria for the bot to check for each position type.
The bot checks each position’s days until expiration before making its next decision.
For credit spreads, the bot will automatically exit the position if it expires in less than two days and the position is challenged.
If the credit spread’s short leg is not challenged, the bot references the Bollinger Band. If the price reverses back through the moving average, the bot closes the position to preserve any profits or mitigate further losses.
As you can see, the monitor automation has a lot going on. But that is the beauty of bots: they can control entries and exits dynamically based on certain conditions.
Adapting the strategy to trade reversions
You can easily modify this bot to trade a reversion instead of a breakout.
To trade a Bollinger Band reversion, you could sell call credit spreads when the indicator reaches the upper range and sell put credit spreads when the indicator reaches the lower range.
If you turn the switch off, you can trade debit spreads when the Bollinger Band serves as support or resistance and price reverts.
You also will need to modify the recipe that checks if the position is close to expiration and is challenged.
If the position is not close to expiration or challenged, you can check the Bollinger Band indicator is still within the mean reversion trading range.
If the position is not at a 50% profit but is also not at risk of being challenged, the position remains open.
Another benefit of bots is the ability to effortlessly test various strategies. You can clone these Bollinger Band strategies and let them run side by side in paper trading.
After a few weeks or months, you can verify the performance of each strategy and decide which to turn on for live trading.
Bots take the mundane, repetitive processes traders deal with on a daily basis and automates them. Automation provides:
- Better consistency
- More time to focus on other aspects of trading (and life)
- Ability to take advantage of opportunities, even if you can’t watch the market
This Bollinger Band strategy is one example of the many strategies that can be automated with a bot. Watch this bot workshop where Kirk builds a Bollinger Band bot step-by-step.
If Bollinger Bands are not for you, check out our RSI swing trading bot.
You can easily clone either Bollinger Band strategy in the Community here: