宽带突破策略是一种趋势跟踪策略。它利用波动率范围来确定进场和出场的时机。具体来说,它使用布林带的上轨和下轨来判断价格是否突破。当价格突破上轨时做多,当价格跌破下轨时平仓。
该策略基于布林带指标。布林带包含三条线:
这里的k值一般取1.5或2。当价格突破上轨时,表示股票进入强势区域,做多;当价格跌破下轨时,表示股票进入弱势区域,平仓。
该策略使用20日中线和1.5倍标准差构建布林带。当价格突破上轨时做多, exited有两种选择:
如果是高波动股票,使用下轨止损效果更好。
该策略主要有以下优势:
该策略也存在一些风险:
可以通过优化参数、结合其它指标等方式来降低这些风险。
该策略可以从以下几个方面进行优化:
宽带突破策略整体来说是一种较为经典的趋势跟踪策略。它可以通过参数优化和规则优化进行改进,使其更适应不同市场环境。该策略易于理解和实现,是量化交易的一个很好的入门策略选择。
/*backtest
start: 2023-12-03 00:00:00
end: 2024-01-02 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Senthaamizh
//@version=4
strategy(title="Bollinger Band Breakout", shorttitle = "BB-BO", 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
exit = input(1, minval=1, maxval=2,title = "Exit Option") // Use Option 1 to exit using lower band; Use Option 2 to exit using moving average
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
if (crossover(source, upper))
strategy.entry("Long", strategy.long, qty=1)
if(exit==1)
if (crossunder(source, lower))
strategy.close("Long")
if(exit==2) //basis is good for N50 but lower is good for BN (High volatility)
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)