Bollinger Band Breakout strategy
Strategy Principles This strategy trades based on Bollinger Band breakouts. The Bollinger Bands consist of a middle band, upper band and lower band. The middle band is an n-period moving average, while the upper and…
Strategy Principles
This strategy trades based on Bollinger Band breakouts. The Bollinger Bands consist of a middle band, upper band and lower band. The middle band is an n-period moving average, while the upper and lower bands are calculated by adding/subtracting x standard deviations from the middle band. A breakout above the upper band indicates an uptrend, while a breakout below the lower band signals a downtrend. The key parameters for constructing the Bollinger Bands are the middle band period n and standard deviation multiplier m. Typical values are 20 periods and 1.5x standard deviations. The settings of n and m directly affect the width of the bands, and therefore the frequency of breakout signals. The period n can be set between 10-20, while the standard deviation multiplier m can be set between 1-2x. More conservative parameter settings generally mean fewer but more reliable breakout signals.
The advantage of this strategy is using Bollinger Bands to determine market trends and volatility, and entering based on breakout signals and exiting on pullbacks. However, issues like band lagging, unreliable breakout signals, and lack of stop loss exist. Overall, this strategy works better in markets with clear trends, but should be used cautiously. Optimization of parameters, adding stops, and signal filters can improve the stability of the strategy.
In summary, while the Bollinger Band breakout strategy has some merits, it also carries significant risks. Only with proper optimization, risk control and money management can this strategy be applied in live trading in a stable manner.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 20 | Period |
| v_input_2 | 1.5 | Standard Deviation |
Source Pine Script
/*backtest
start: 2022-09-04 00:00:00
end: 2023-09-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="Bollinger Band Breakout", shorttitle = "BB-BO",default_qty_type = strategy.percent_of_equity,default_qty_value = 100, overlay=true)
source = close
length = input(20, minval=1, title = "Period") //Length of the Bollinger Band
mult = input(1.5, minval=0.001, maxval=50, title = "Standard Deviation") // Use 1.5 SD for 20 period MA; Use 2 SD for 10 period MA
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
if (crossover(source, upper))
strategy.entry("Long", strategy.long)
if(crossunder(source, basis))
strategy.close("Long")
plot(basis, color=color.red,title= "SMA")
p1 = plot(upper, color=color.blue,title= "UB")
p2 = plot(lower, color=color.blue,title= "LB")
fill(p1, p2)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-11. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Bollinger-Band-Breakout-strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Adaptive Bollinger Breakout with Moving Average Quantitative Strategy SystemPine Script · Breakout · 1h
- BB Breakout StrategyPine Script · Breakout · 1d
- Bollinger Band Breakout Trend Following StrategyPine Script · Breakout · 1d
- Bollinger Band Channel Breakout Trading StrategyPine Script · Breakout · 1d
- Bollinger Band T3 Moving Average StrategyPine Script · Breakout · 10m
- Bollinger Bands Breakout Trading StrategyPine Script · Breakout · 1h