
이 전략은 가격 채널을 구성하여 가격의 중심선에서 벗어난 거리를 계산하고, 그 다음 평선 필터링 신호를 결합하여 트렌드를 식별하고 추적합니다. 가격이 채널을 뚫을 때 거래 신호를 생성합니다. 이 전략은 트렌드 추적과 뚫림 두 가지 특징을 동시에 가지고 있습니다.
이 전략은 전체적으로 안정적이며, 중장선 트렌드를 효과적으로 추적할 수 있으며, 트렌드 돌파구와 결합하여 거래 신호를 생성한다. 매개 변수 최적화 및 신호 필터링을 통해 전략을 더 개선하여 더 많은 품종과 시장 환경에 적합하게 만들 수 있다.
/*backtest
start: 2023-01-30 00:00:00
end: 2024-02-05 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Noro's Bands Strategy v1.1", shorttitle = "NoroBands str 1.1", overlay=true)
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
len = input(20, defval = 20, minval = 2, maxval = 200, title = "Period")
color = input(true, "Color")
needbb = input(true, defval = false, title = "Show Bands")
needbg = input(true, defval = false, title = "Show Background")
src = close
//PriceChannel 1
lasthigh = highest(src, len)
lastlow = lowest(src, len)
center = (lasthigh + lastlow) / 2
//dist
dist = abs(src - center)
distsma = sma(dist, len)
hd = center + distsma
ld = center - distsma
//Trend
trend = close < ld and high < hd ? -1 : close > hd and low > ld ? 1 : trend[1]
//Lines
colo = needbb == false ? na : black
plot(hd, color = colo, linewidth = 1, transp = 0, title = "High band")
plot(center, color = colo, linewidth = 1, transp = 0, title = "center")
plot(ld, color = colo, linewidth = 1, transp = 0, title = "Low band")
//Background
col = needbg == false ? na : trend == 1 ? lime : red
bgcolor(col, transp = 90)
//Signals
up = trend == 1 and ((close < open or color == false) or close < hd) ? 1 : 0
dn = trend == -1 and ((close > open or color == false) or close > ld) ? 1 : 0
longCondition = up == 1
if (longCondition)
strategy.entry("Long", strategy.long, needlong == false ? 0 : na)
shortCondition = dn == 1
if (shortCondition)
strategy.entry("Short", strategy.short, needshort == false ? 0 : na)