Bollinger Breakout Strategy 427440
This strategy is based on Bollinger Bands indicator, taking long or short positions when price breaks out of Bollinger Bands upper or lower lines. It aims to profit from catching breakout moves.
Overview
This strategy is based on Bollinger Bands indicator, taking long or short positions when price breaks out of Bollinger Bands upper or lower lines. It aims to profit from catching breakout moves.
Strategy Logic
- Calculate Bollinger midline, upper and lower lines
- Go long on lower line breakout; go short on upper line breakout
- Set start and end time to define trading hours
- Set holding time, default to intraday exit
Specifically, it first calculates the midline SMA of length length, and upper/lower lines of mult times standard deviation. When close breaks out upward from the lower line, go long. When close breaks down from the upper line, go short. Also set start and end time to limit trading hours. Exit before daily open.
The strategy attempts to capture expanding moves after price breaks out of bands. Breaking lower band indicates strengthening bullish forces, while breaking upper band means strengthening bearish forces, so trading in line with breakout is favorable.
Advantage Analysis
- Simple and intuitive, easy to understand and implement
- Utilize Bollinger Bands to judge trend breakouts, has some trend following capacity
- Flexible parameter adjustment for different cycles and products
- Intraday exit controls overnight risk
- Can enable only long or short trading
Risk Analysis
- False breakout risk. Price may retrace after initial breakout.
- Need timely parameter tuning. Parameters need adjustments for different cycles.
- Potential loss enlargement risk. Larger breakout range may expand losses.
- Increased transaction costs. Frequent trading may increase transaction costs.
Risks can be reduced by optimizing entry rules, adding stop loss, introducing trend filter etc.
Optimization Directions
- Optimize parameters for different cycles
- Add re-entry and pyramiding rules to follow trends
- Introduce stop loss to control risks
- Set trading hours to avoid significant news events
- Test trend filters to avoid choppy price action
- Evaluate different holding periods and compare results
Summary
This is a breakout strategy based on Bollinger Bands. It profits from breakout moves. Pros are simple logic and easy implementation; Cons are susceptibility to false breakouts. Risks can be managed through parameter optimization, stop loss, trading hours control etc. It allows traders to understand basics of using indicators and trading breakouts.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | Long |
| v_input_2 | true | Short |
| v_input_3 | 20 | length |
| v_input_4 | true | mult |
| v_input_5 | 1900 | From Year |
| v_input_6 | 2100 | To Year |
| v_input_7 | true | From Month |
| v_input_8 | 12 | To Month |
Source Pine Script
/*backtest
start: 2023-08-21 00:00:00
end: 2023-09-20 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy("Noro's Bollinger Strategy v1.0", shorttitle = "Bollinger str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.0, pyramiding = 5)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
length = input(20, minval=1)
mult = input(1.0, minval=0.001, maxval=50)
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
source = close
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
up = close < lower
dn = close > upper
exit = (strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)
if up
strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, 01, 00, 00) and time < timestamp(toyear, tomonth, 31, 00, 00)))
if dn
strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, 01, 00, 00) and time < timestamp(toyear, tomonth, 31, 00, 00)))
if time > timestamp(toyear, tomonth, 31, 00, 00) or exit
strategy.close_all()Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-21. 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-Breakout-Strategy-427440.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