이중 이동 평균 크로스오버 트렌드 추적 전략

저자:차오장, 날짜: 2023-09-28 11:52:16
태그:

전반적인 설명

이 전략은 트렌드를 결정하고 추적하기 위해 트렌드 추적 지표와 결합된 이중 이동 평균 크로스오버 원리를 활용합니다. 주요 아이디어는 짧은 기간 이동 평균이 긴 기간 이동 평균을 넘어서면 긴 기간 이동 평균을 넘어서면 짧은 기간 이동 평균이 긴 기간 이동 평균을 넘어서면 짧습니다. 전체 트렌드 방향은 또한 잘못된 브레이크를 피하기 위해 100 일 이동 평균에 의해 결정됩니다.

전략 논리

이 전략은 주로 이중 이동 평균 크로스오버 시스템과 트렌드 추적 시스템으로 구성됩니다.

이중 이동 평균 크로스오버 시스템은 빠른 EMA1과 느린 EMA2를 포함합니다. 기본 기간은 EMA1에 10일이고 EMA2에 20일입니다. EMA1가 EMA2를 넘을 때 구매 신호가 생성됩니다. EMA1가 EMA2를 넘을 때 판매 신호가 생성됩니다.

100일 EMA (EMA100) 는 전체 트렌드 방향을 결정하기 위해 추가됩니다. 가격이 상승 추세에 있을 때만 구매 신호가 생성됩니다. 가격이 하락 추세에 있을 때만 판매 신호가 생성됩니다. 이것은 대부분의 잘못된 브레이크아웃 상황을 필터링합니다.

구매 및 판매 화살표는 또한 촛불에 표시되어 거래 신호를 시각적으로 표시합니다.

트렌드 추적 시스템은 트렌드 방향을 다시 확인하기 위해 내일 및 사이클 일선을 사용합니다. 내일은 5 분 및 60 분 하이킨-아시 이동 평균을 사용하지만 사이클은 매일 라인의 8 일 및 12 일 이동 평균을 사용합니다.

거래 신호는 내일 및 주기 판단이 일치 할 때만 생성됩니다. 이것은 주요 트렌드 방향이 아닌 대부분의 잡음을 더 필터합니다.

이점 분석

이 전략의 가장 큰 장점은 트렌드 추적과 이동 평균 크로스오버 시스템의 통합입니다. 이는 잘못된 신호를 효과적으로 필터링하고 수용 가능한 수준 내에서 유출을 유지합니다.

특히 이중 이동 평균 교차 시스템의 장점은 다음과 같습니다.

  1. 단순하고 이해하기 쉬운 논리, 초보자에게 적합합니다.

  2. 트렌드 추종, 트렌드에 반대하는 거래를 피합니다.

  3. 빠른 EMA 기간과 느린 EMA 기간을 조정할 수 있고, 다른 주기에 적응할 수 있습니다.

  4. 주요 트렌드에서 높은 수익성

EMA100를 추가하면 다음과 같은 장점이 있습니다.

  1. 트렌드에 반하는 거래를 피하고 손실을 줄입니다.

  2. 추세를 따라, 수요를 조절할 수 있도록

트렌드 추적 시스템은 다음과 같은 장점을 가지고 있습니다.

  1. 여러 시간 프레임 분석, 단일 기간 소음을 피합니다.

  2. 주요 트렌드 방향에 맞춰서 마이너드 다운을 줄이는 것.

  3. 하이킨-아시는 소음을 부드럽게 하고, 트렌드를 파악합니다.

위험 분석

이 전략에서 주목해야 할 몇 가지 위험:

  1. 연장된 통합 과정에서 빈번한 크로스오버 및 추가 거래 비용

  2. 지연된 신호, 초기 트렌드 단계를 놓치고 있습니다.

  3. 주요 트렌드가 뒤집어지면 심각한 손실이 발생합니다.

  4. 성능은 매개 변수 최적화에 달려 있습니다.

해결책:

  1. 통일 기간 동안 거래 빈도를 줄이세요.

  2. EMA 기간을 짧게 하여 더 이른 트렌드 신호를 얻을 수 있습니다.

  3. 단일 손실을 제어하기 위해 스톱 손실을 사용하십시오.

  4. 다양한 제품 및 시장 조건에 대한 매개 변수를 최적화합니다.

최적화 방향

이 전략은 다음 영역에서 최적화 될 수 있습니다.

  1. EMA 기간 최적화. 최적 기간을 찾기 위해 더 많은 조합을 테스트합니다.

  2. 더 많은 시간 프레임 판단을 추가하십시오. 예를 들어 월간 또는 분기 라인업.

  3. 이동 또는 기하급수적 중지와 같은 중지 손실 메커니즘을 포함합니다.

  4. 밸런스 볼륨과 같은 볼륨 지표와 결합합니다.

  5. MACD와 같은 더 빠른 오시레이터를 사용하여 출입 시기를 개선하십시오.

  6. 더 많은 제품과 자산을 위한 파라미터 최적화

결론

이 전략은 단일 시스템의 약점을 피하여 이중 이동 평균 크로스오버 및 트렌드 추적 시스템의 장점을 결합합니다. 여러 시간 프레임 분석은 올바른 거래 방향을 보장하며 마감 통제가 훌륭합니다. 추가 최적화는 실용적인 사용을 위해 더 많은 시장 환경에 적응 할 수 있습니다.


/*backtest
start: 2023-09-20 00:00:00
end: 2023-09-27 00:00:00
period: 1h
basePeriod: 15m
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/
// © askkuldeeprandhawa

//@version=4

strategy("KSR Strategy", overlay=true)



par1=input(10)
par2=input(20)
ema1=ema(close,par1)
ema2=ema(close,par2)
buy=ema1>ema2
sell=ema2<ema1
mycolor= iff(buy,color.green,iff(sell,color.blue,color.red))
barcolor(color=mycolor)



ema100=ema(close,100)
ibuy=crossover(ema1,ema2)
iSell=crossunder(ema1,ema2)

varp=tostring(close[1])
plotshape(ibuy, "Up Arrow", shape.triangleup, location.belowbar, color.green, 0, 0,"Buy" , color.green, true, size.tiny)
plotshape(iSell, "Down Arrow", shape.triangledown, location.abovebar, color.red, 0, 0, "Sell", color.red, true, size.tiny)

crossed =crossover(ema(close,par1), ema(close,par2))
// if crossed
//     l = label.new(bar_index, na, tostring(close), 
//          color=color.green, 
//          textcolor=color.white,
//          style=label.style_labelup, yloc=yloc.belowbar)
         
crossed2 =crossunder(ema(close,par1), ema(close,par2))
// if crossed2
//     l = label.new(bar_index, na, tostring(close), 
//          color=color.red, 
//          textcolor=color.white,
//          style=label.style_labeldown, yloc=yloc.abovebar)
         
plot(ema(close,par1),"EMA Short",color=color.white)
plot(ema(close,par2),"EMA Long",color=color.orange)


longCondition = crossover(ema(close, par1), ema(close, par2))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = crossunder(ema(close, par1), ema(close, par2))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)




ma1_len = input(title="MA1", type=input.integer, defval=8, minval=1, maxval=100, step=1)
ma2_len = input(title="MA2", type=input.integer, defval=12, minval=1, maxval=100, step=1)

o = ema(open, ma1_len)
c = ema(close, ma1_len)
h = ema(high, ma1_len)
l = ema(low, ma1_len)

tim1=input('D',"Short Time")
tim2=input('W',"Long Time")

ema_p=input(title="EMA Period", type=input.integer, defval=16, minval=1, maxval=100, step=1)
refma = ema(close, ema_p)
plot(refma, title="EMA" , linewidth=1, color=close < refma ? color.orange : color.blue)
ha_t = heikinashi(syminfo.tickerid)
ha_o = security(ha_t, tim2, o)
ha_c = security(ha_t, tim2, c)
ha_h = security(ha_t, tim2, h)
ha_l = security(ha_t, tim2, l)
o2 = ema(ha_o, ma2_len)
c2 = ema(ha_c, ma2_len)
h2 = ema(ha_h, ma2_len)
l2 = ema(ha_l, ma2_len)
ha_col = ha_c > ha_o ? color.red : color.green
plotshape(true, style=shape.circle, color=ha_c > ha_o ? color.green : color.red, location=location.bottom)


ha_t1 = heikinashi(syminfo.tickerid)
ha_o1 = security(ha_t1, tim1, o)
ha_c1 = security(ha_t1, tim1, c)
ha_h1 = security(ha_t1, tim1, h)
ha_l1 = security(ha_t1, tim1, l)
o3 = ema(ha_o1, ma2_len)
c3 = ema(ha_c1, ma2_len)
h3 = ema(ha_h1, ma2_len)
l3 = ema(ha_l1, ma2_len)
ha_col1 = ha_c1 > ha_o1 ? color.red : color.green
plotshape(true, style=shape.circle, color=ha_c1 > ha_o1 ? color.green : color.red, location=location.top)







더 많은