
이 전략은 동치안 통로 지표에 기반한 트렌드 추적 전략이며, ATR 지표의 동적 스톱로스를 결합하여 수익을 잠금하는 트렌드 추적 전략에 속한다.
이 전략은 20주기 길이의 唐通道指標를 사용하며,通道中線은 최고 가격과 최저 가격의 평균이다. 가격이 위쪽을 가로질러通道中線을 넘으면 더하고, 가격이 아래쪽을 가로질러通道中線을 넘으면 공백한다. 평준화 조건은 가격이 동적 스톱레이드를 만지는 것이다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 다음과 같은 위험들이 있습니다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
이 전략은 전체적으로 간단한 실용형 트렌드 추적 전략으로, 동치안 통로를 통해 트렌드 방향을 판단하고, 동적 스톱로스를 사용하여 수익을 잠금 할 수 있습니다. 전략은 실용성이 강하지만, 여러 가지 방법으로 추가적으로 최적화 할 수 있으므로 전략은 더 복잡한 시장 환경에서 안정적인 수익을 유지할 수 있습니다.
/*backtest
start: 2023-11-29 00:00:00
end: 2023-12-06 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title = "dc", overlay = true)
atrLength = input(title="ATR Length:", defval=20, minval=1)
testStartYear = input(2017, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testEndYear = input(2018, "Backtest Start Year")
testEndMonth = input(12)
testEndDay = input(31, "Backtest Start Day")
testPeriodEnd = timestamp(testEndYear,testEndMonth,testEndDay,0,0)
testPeriod() =>
true
//time >= testPeriodStart ? true : false
dcPeriod = input(20, "Period")
dcUpper = highest(close, dcPeriod)[1]
dcLower = lowest(close, dcPeriod)[1]
dcAverage = (dcUpper + dcLower) / 2
atrValue=atr(atrLength)
useTakeProfit = na
useStopLoss = na
useTrailStop = na
useTrailOffset = na
//@version=1
Buy_stop = lowest(low[1],3) - atr(20)[1] / 3
plot(Buy_stop, color=red, title="buy_stoploss")
Sell_stop = highest(high[1],3) + atr(20)[1] / 3
plot(Sell_stop, color=green, title="sell_stoploss")
plot(dcLower, style=line, linewidth=3, color=red, offset=1)
plot(dcUpper, style=line, linewidth=3, color=aqua, offset=1)
plot(dcAverage, color=black, style=line, linewidth=3, title="Mid-Line Average")
strategy.entry("simpleBuy", strategy.long, when=(close > dcAverage) and cross(close,dcAverage))
strategy.close("simpleBuy",when= ( close< Buy_stop))
strategy.entry("simpleSell", strategy.short,when=(close < dcAverage) and cross(close,dcAverage) )
strategy.close("simpleSell",when=( close > Sell_stop))
//strategy.exit("Exit simpleBuy", from_entry = "simpleBuy", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)
//strategy.exit("Exit simpleSell", from_entry = "simpleSell", profit = useTakeProfit, loss = useStopLoss, trail_points = useTrailStop, trail_offset = useTrailOffset)