Donchian 채널 추세 추종 전략


생성 날짜: 2023-11-06 15:52:56 마지막으로 수정됨: 2023-11-06 15:52:56
복사: 0 클릭수: 801
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

Donchian 채널 추세 추종 전략

개요

동치안 통로 트렌드 추적 전략은 동치안 통로 지표에 기반한 트렌드 추적 전략이다. 이 전략은 상위 궤도, 하위 궤도, 중간에 형성되는 다양한 주기의 최고 가격과 최저 가격을 계산하여 시장의 트렌드 방향을 판단하여 트렌드 추적 거래를 구현한다.

전략 원칙

이 전략은 먼저 재검토 시간 범위를 설정하고, 그 다음에는 다수점과 공백점 포지션 개설 규칙을 정의한다.

다수 머리의 경우, 가격이 동천 통로를 통과했을 때 다수 머리의 포지션을 열고, 가격이 궤도를 통과했을 때 다수 머리의 평점을 니다.

공평한 경우, 가격이 도징안 통로의 하차선을 통과했을 때 공평한 입장을 취하고, 가격이 상차선을 통과했을 때 공평한 입장을 취한다.

전략은 또한 ATR 지표를 도입하여 스톱로스 탈퇴 메커니즘을 설정한다. ATR 값은 스톱로스로 한 계수를 곱한다.

구체적으로 말하면, 다수 헤드 스톱은 포지션 개시 가격에 ATR 스톱값을 빼고, 공수 헤드 스톱은 포지션 개시 가격에 ATR 스톱값을 더한다.

이 전략은 동치안 통로의 상하 궤도를 그리고 ATR 중지 라인을 동시에 그리며 완전한 거래 시스템을 형성한다.

전략적 이점

  • 동천 통로를 사용하여 트렌드 방향을 판단하고, 어느 정도 트렌드 추적 능력을 가지고 있다.

  • 동천 통로 Smoother 파라미터는 조정할 수 있으며, 파라미터 최적화를 통해 최적의 파라미터 조합을 찾을 수 있다.

  • ATR 지표와 함께 스톱로스 설정 메커니즘을 사용하면 위험을 효과적으로 제어 할 수 있습니다.

  • 다공석 거래 규칙은 명확하고 이해하기 쉽다.

  • 코드 구조가 명확하고, 이해하기 쉽고, 재개발하기 쉽다.

전략적 위험

  • 동천 통로 (唐通道) 는 재조정 범위 내의 가격 변동에 대해, 잘못된 거래의 위험이 있다.

  • ATR 중지 범위가 잘못 설정되어 너무 넓거나 너무 민감하게 중지될 수 있습니다.

  • 다수 공백점 포지션은 너무 집중될 수 있으며, 포지션 관리 규칙을 설정할 필요가 있다.

  • 거래 품종의 적합성을 검증해야 하며, 다른 품종의 매개 변수는 독립적으로 최적화되어야 한다.

  • 거래비용도 고려해야 하며, 고비용 환경에서는 조정해야 합니다.

전략 최적화 방향

  • 동천 통로의 통로 주기 변수를 최적화하여 최적의 변수 조합을 찾습니다.

  • 다른 ATR 계수 설정을 시도하여 최적의 손해 범위를 찾으십시오.

  • ATR을 기준으로 이동한 손실을 도입하여 수익을 고정시키도록 시도한다.

  • 시장 상황에 따라 다중 공수 포지션 비율을 적절히 조정하십시오.

  • 다양한 품종의 매개 변수의 강도를 테스트하고, 일반적인 매개 변수 조합을 찾습니다.

  • 전략의 안정성을 높이기 위해 사운드 포크 지표와 같은 필터를 도입하는 연구가 진행되고 있다.

  • 다른 거래 비용 환경 테스트 파라미터의 적합성.

요약하다

종합적으로 설명하자면, 이 전략은 전체적으로 비교적 간단한 트렌드 추적 전략으로, 핵심은 돈치안 통로의 적용에 있다. 이 전략의 장점은 간단하고 이해하기 쉽고, 학습에 적합하지만, 여전히 매개 변수와 위험에 대한 최적화가 필요하다. 다양한 최적화 수단을 통해 전략의 안정성과 수익성을 향상시킬 수 있다.

전략 소스 코드
/*backtest
start: 2022-10-30 00:00:00
end: 2023-11-05 00:00:00
period: 1d
basePeriod: 1h
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/
// © kriswaters

//@version=4
strategy("Donchian Channels Strategy by KrisWaters", overlay=true ) 

// Date filter
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromYear  = input(defval = 2017, title = "From Year", minval = 1900)
ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToYear    = input(defval = 9999, title = "To Year", minval = 2017)

start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start window
finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)        // backtest finish window
window()  => true // create function "within window of time"

// Strategy Settings
canEnterLong = input(true, title="Can Enter Long Position")
canEnterShort = input(false, title="Can Enter Short Position")

showLongChannel = input(true, title="Show Donchian Long Channels")
showShortChannel = input(false , title="Show Donchian Short Channels")

useAtrAsStopRule = input(false, title="Enable ATR Stop Rule") 

// DonCcian Channel Lengths
longUpperLength = input(20, minval=1)
longLowerLength = input(10, minval=1)

shortUpperLength = input(10, minval=1)
shortLowerLength = input(20, minval=1)

// Donchian indicator calculations
longUpperValue = highest(high,longUpperLength)
longLowerValue = lowest(low,longLowerLength)

shortUpperValue = highest(high,shortUpperLength)
shortLowerValue = lowest(low,shortLowerLength)

// Plot Donchian Channels
uLong = plot(showLongChannel ? longUpperValue : na, color=color.green, offset=1)
lLong = plot(showLongChannel ? longLowerValue : na, color=color.green, offset=1)

uShort = plot(showShortChannel ? shortUpperValue : na, color=color.red, offset=1)
lShort = plot(showShortChannel ? shortLowerValue : na, color=color.red, offset=1)

// Styling
fill(uLong,lLong, color=color.green, transp=95, title="Long Arkaplan")
fill(uShort,lShort, color=color.red, transp=95, title="Short Arkaplan")

// Stop-loss value calculations
atrMultiplier = 2.0
atrValue = atr(20)
longStopValue = open - (atrMultiplier*atrValue)
shortStopValue = open + (atrMultiplier*atrValue)

// Plot stop-loss line
plot(useAtrAsStopRule ? longStopValue : na, color=color.red, linewidth=2, offset=1)
plot(useAtrAsStopRule ? shortStopValue : na, color=color.red, linewidth=2, offset=1)

// Long and Short Position Rules
if canEnterLong and na(longUpperValue) != true and na(longLowerValue) != true and window()
    strategy.entry("Long", true, stop=longUpperValue)
    strategy.exit("Long Exit", "Long", stop=useAtrAsStopRule ? max(longLowerValue,longStopValue) : longLowerValue)
    
if canEnterShort and na(shortUpperValue) != true and na(shortLowerValue) != true and window()
    strategy.entry("Short", false, stop=shortLowerValue)
    strategy.exit("Short Exit", "Short", stop=useAtrAsStopRule ? min(shortUpperValue,shortStopValue) : shortUpperValue)