Bollinger Bands Breakout Strategy

Author: ChaoZhang, Date: 2024-04-30 17:21:16



This strategy uses Bollinger Bands as the main indicator, entering a long position when the closing price breaks above the upper band and a short position when it breaks below the lower band. Bollinger Bands consist of a middle band (moving average), an upper band (middle band + standard deviation), and a lower band (middle band - standard deviation). The strategy aims to capture market trends by buying when the price breaks above the upper band and selling when it breaks below the lower band, while using the middle band as the exit condition.

Strategy Principle

  1. Calculate the middle, upper, and lower bands of the Bollinger Bands. The middle band is the simple moving average of the closing price, while the upper and lower bands are obtained by adding and subtracting a certain multiple of the standard deviation from the middle band.
  2. Enter a long position when the closing price breaks above the upper band; enter a short position when the closing price breaks below the lower band.
  3. Exit conditions: Close long positions when the closing price falls below the middle band; close short positions when the closing price breaks above the middle band.

Strategy Advantages

  1. The strategy, based on the Bollinger Bands indicator, can effectively capture market trends and enter positions at the early stage of trend formation, which is conducive to obtaining more profits.
  2. Using the middle band as the exit condition can avoid holding positions when the trend reverses, thereby reducing risk.
  3. The strategy logic is clear and easy to understand and implement.

Strategy Risks

  1. The selection of Bollinger Bands parameters (such as length and multiplier) will affect the strategy’s performance, and different parameters may lead to different results.
  2. In a volatile market, the strategy may frequently open and close positions, resulting in high transaction costs.
  3. The strategy does not consider fundamental factors of the market and relies entirely on technical indicators, which may generate false signals in some cases.

Strategy Optimization Directions

  1. Introduce other technical indicators or market sentiment indicators to confirm the validity of the Bollinger Bands breakout signals and improve the accuracy of the strategy.
  2. Optimize Bollinger Bands parameters, such as dynamically adjusting the length and multiplier of the Bollinger Bands according to different market conditions to adapt to market changes.
  3. Add risk management measures, such as setting stop-loss and take-profit levels, to control the risk of a single transaction.
  4. Consider the strength of market trends, hold positions when the trend is strong, and avoid trading in weak trends or volatile markets to improve strategy returns and reduce the cost of frequent trading.


The Bollinger Bands Breakout Strategy captures market trends through breakouts of the upper and lower bands of the Bollinger Bands, with the middle band serving as the exit condition. The strategy logic is clear and easy to implement, and it can effectively capture trends. However, there are certain risks in parameter selection and volatile markets. In the future, the strategy’s performance can be improved by introducing other indicators, optimizing parameters, adding risk management, and other methods.

start: 2023-04-24 00:00:00
end: 2024-04-29 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

strategy("Bollinger Bands Strategy", shorttitle='BB Strategy', overlay=true)

// Bollinger Bands parameters
length =, title="Length")
mult = input.float(2.0, title="Multiplier")

// Calculate Bollinger Bands
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper_band = basis + dev
lower_band = basis - dev

// Plot Bollinger Bands
plot(basis,, title="Basis")
plot(upper_band,, title="Upper Band")
plot(lower_band,, title="Lower Band")

// Strategy
long_condition = ta.crossover(close, upper_band)
short_condition = ta.crossunder(close, lower_band)

if (long_condition)
    strategy.entry("Long", strategy.long)
if (short_condition)
    strategy.entry("Short", strategy.short)

// Exit conditions
exit_long_condition = ta.crossunder(close, basis)
exit_short_condition = ta.crossover(close, basis)

if (exit_long_condition)
if (exit_short_condition)