돈치안 채널에 기초한 거북이 무역 전략

저자:차오장, 날짜: 2023-12-25 10:57:52
태그:

img

전반적인 설명

이 전략의 이름은 Turtle Trading Strategy Based on Donchian Channels이다. 유명한 Turtle Trading Rules의 주요 아이디어를 빌려 Turtle Trading Rules에서 주요 아이디어를 빌려 시장 트렌드를 결정하기 위해 Donchian Channels를 사용하여 필터레이션의 이동 평균과 결합하여 비교적 간단한 트렌드 다음 전략을 실현합니다.

전략 원칙

이 전략의 판단을 위한 주요 지표는 돈치안 채널이다. 돈치안 채널은 N일 기간 동안 가장 높고 가장 낮은 가격의 변동 범위로 구성된다. 가격이 채널의 상부 레일을 통과하면 긴 신호가 될 것이고, 채널의 하부 레일을 통과하면 짧은 신호가 될 것이다. 이 전략은 신호를 발산하기 위해 빠른 돈치안 채널 (10일) 을 사용하고 손실을 멈추기 위해 느린 돈치안 채널 (20일) 을 사용합니다.

또한, 이 전략은 신호를 필터하기 위해 두 개의 이동 평균 라인을 (50일 라인과 125일 라인) 도입하기도 한다. 빠른 이동 평균 라인이 느린 이동 평균 라인을 넘을 때만, 긴 포지션은 거래될 것이다; 빠른 이동 평균 라인이 느린 이동 평균 라인을 넘을 때만, 짧은 포지션은 거래될 것이다. 이것은 일부 잘못된 신호를 효과적으로 필터링할 수 있다.

이 전략의 개시 조건은: 가격이 돈치안 채널의 상부 레일을 뚫고, 빠른 이동 평균 라인이 느린 이동 평균 라인을 넘어서게 된다. 두 조건이 충족되면 긴 포지션은 열릴 것이다; 가격이 돈치안 채널의 하부 레일을 뚫고, 빠른 이동 평균 라인이 느린 이동 평균 라인을 넘어서, 짧은 포지션을 열게 된다. 닫는 조건은 가격이 반대편의 느린 돈치안 채널 경계를 만지면이다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. 동향 방향을 결정하기 위해 Donchian 채널을 사용 하 여, 백테스트 효과는 큰 동향을 성공적으로 포착 하기 위해 더 좋습니다.

  2. 이동 평균 필터를 추가하면 일부 잘못된 신호를 필터링하고 손실을 피할 수 있습니다.

  3. 빠르고 느린 돈체인 채널과 이동 평균의 조합은 거래 빈도와 스톱 로스 정확성을 균형 잡을 수 있습니다.

  4. 단 1회 손실을 통제하기 위한 스톱 로스 메커니즘으로 위험은 잘 통제됩니다.

위험 분석

이 전략의 몇 가지 위험:

  1. 쇼크 시장에서는 더 작은 손실 주문이 있을 수 있습니다.

  2. 트렌드 반전이 발생하면 이동 평균의 필터링이 시작 비용을 증가시킵니다.

  3. 급격한 시장에서, 스톱 로스는 추격될 수 있습니다.

대책 및 해결책:

  1. 적절한 매개 변수를 조정하고, 돈치 주기를 단축하고, 다른 시장에 적응하기 위해 이동 평균 주기를 줄입니다.

  2. 주요 트렌드에 대한 판단을 높여 주요 트렌드에 반대하는 포지션을 구축하지 않도록하십시오.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 예를 들어, 부피를 도입, 부피가 커질 때만 포지션을 오픈;

  2. 뜨거운 영역의 판단을 높여 포지션을 열 때 뜨거운 영역을 피하기 위해 지원, 압력, 밴드, 패턴 등을 결합;

  3. 스톱 로스 전략을 최적화 합니다. 스톱 로스를 추적, 변동성 스톱 로스, 시간 스톱 로스 등을 도입하여 스톱 로스를 더 똑똑하게 만듭니다.

요약

일반적으로 이 전략은 트렌드를 따르는 매우 전형적이고 간단한 전략이다. 도치안 채널을 통해 방향을 결정하고 이동 평균을 통해 신호를 필터함으로써 좋은 백테스트 결과를 실현한다. 이 전략은 좋은 위험 통제와 실제 거래에서 구현하기 쉬운 큰 트렌드를 추구하고있는 투자자에게 적합하다. 일부 매개 변수와 규칙을 최적화함으로써 승률과 수익성이 더욱 향상될 수 있다.


/*backtest
start: 2023-11-24 00:00:00
end: 2023-12-24 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
// Coded by Vladkos
strategy("Donchian strategy with filter", overlay=true,default_qty_type = strategy.percent_of_equity, default_qty_value = 4,pyramiding=5)

fromyear = input(2017, defval = 2018, minval = 1800, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(21, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
term = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59))
ATR=input(20,minval=1)
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
needstoploss= input(true,defval=true,title="Stop LOSS")
///////////ATR
tra=atr(ATR)


////////////Переменные
Donchian_slow=input(20,minval=1)
Donchian_fast=input(10,minval=1)
Slow_EMA=input(125,minval=1)
Fast_EMA=input(50,minval=1)

/////////// Медленный Дончан
lower = lowest(Donchian_slow)
upper = highest(Donchian_slow)
basis = avg(upper, lower)
plot(lower,color=blue)
plot(upper,color=blue)

/////////// быстрый Дончан
lowerF = lowest(Donchian_fast)
upperF = highest(Donchian_fast)
basisF = avg(upperF, lowerF)
plot(lowerF,color=red)
plot(upperF,color=red)

////////// Скользящие средние
ema_S=ema(close,Slow_EMA)
ema_F=ema(close,Fast_EMA)
plot(ema_S,color=red)
plot(ema_F,color=green)

///////// Условия сделок
long_condition= close>=upper[1] and ema_F>ema_S  
long_exit= close<lowerF[1]

short_condition=close<=lower[1] and ema_F<ema_S
short_exit=close>upperF[1]

////////// Отправка ордеров
strategy.entry("Long",strategy.long,when=long_condition and term and needlong==true)
strategy.exit("stop loss","Long",stop=strategy.position_avg_price-(tra*2),when= (needstoploss==true))
strategy.close("Long",when=long_exit and (time < timestamp(toyear, tomonth, today, 23, 59)))
    
strategy.entry("Short",strategy.short,when=short_condition and term and (needshort==true))
strategy.exit("stoploss","Short",stop=strategy.position_avg_price+(tra*2),when= (needstoploss==true))
strategy.close("Short",when=short_exit and (time < timestamp(toyear, tomonth, today, 23, 59)))

if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()






더 많은