
STARC通道回测策略是基于STARC指标的量化交易策略。该策略通过构建STARC上下通道,实现突破买入和突破卖出的交易信号生成。同时,策略内置长短仓切换机制,可以适应不同市场环境。
STARC通道回测策略的核心是STARC指标。该指标包括:
当收盘价大于上轨时,产生买入信号;当收盘价低于下轨时,产生卖出信号。
该策略每日计算STARC通道的上下轨,并判断收盘价是否突破上下轨生成交易信号。同时,策略设置了反转参数,可以在长仓和空仓之间切换,适应不同市场行情。
STARC通道回测策略具有以下优势:
STARC通道回测策略也存在一定的风险:
需要采取如下措施防范风险:
STARC通道回测策略的主要优化方向包括:
这些优化方向能够在控制风险的前提下,提高策略的收益率和稳定性。
STARC通道回测策略整体效果良好,基于STARC指标实现了中长线突破交易。策略优势是使用STARC通道产生交易信号稳定,同时设置反转机制可以适应市场变化。我们也需要防范shean,设置止损和优化参数,使策略更稳定高效。总的来说,该策略是中长线突破交易的有效工具。
/*backtest
start: 2023-11-04 00:00:00
end: 2023-12-04 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 23/04/2018
// A type of technical indicator that is created by plotting two bands around
// a short-term simple moving average (SMA) of an underlying asset's price.
// The upper band is created by adding a value of the average true range
// (ATR) - a popular indicator used by technical traders - to the moving average.
// The lower band is created by subtracting a value of the ATR from the SMA.
// STARC is an acronym for Stoller Average Range Channels. The indicator is
// named after its creator, Manning Stoller.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="STARC Bands Backtest", overlay = true)
LengthMA = input(5, minval=1)
LengthATR = input(15, minval=1)
K = input(1.33, minval=0.01, step = 0.01)
reverse = input(false, title="Trade reverse")
xMA = sma(close, LengthMA)
xATR = atr(LengthATR)
xSTARCBandUp = xMA + xATR * K
xSTARCBandDn = xMA - xATR * K
pos = iff(close > xSTARCBandUp, 1,
iff(close < xSTARCBandDn, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xMA, color=blue, title="MA")
plot(xSTARCBandUp, color = green, title="UpBand")
plot(xSTARCBandDn, color=red, title="DnBand")