기하급수적 이동 평균에 기초한 모멘텀 크로스오버 전략

저자:차오장, 날짜: 2024-01-23 14:18:26
태그:

img

전반적인 설명

이 전략은 다른 기간과 EMA 라인의 교차를 기반으로 트렌드 방향을 결정하고 그에 따라 긴 및 짧은 신호를 생성합니다. 주로 두 이동 평균 - 10 일 EMA 및 20 일 EMA를 사용합니다. 10 일 EMA가 20 일 EMA 아래로 넘을 때 짧은 신호가 발동됩니다. 10 일 EMA가 20 일 EMA를 넘을 때 긴 신호가 발동됩니다. 이 전략은 중장기 거래 전략에 속합니다.

전략 원칙

이 전략은 10일 EMA와 20일 EMA를 포함한 두 개의 EMA 라인을 이용한다. EMA 라인은 가격의 트렌드를 효과적으로 반영할 수 있다. 단기 EMA 라인이 장기 EMA 라인의 위를 넘을 때, 이는 가격 트렌드가 하락에서 상승으로 전환되는 것을 나타냅니다. 단기 EMA 라인이 장기 EMA 라인의 아래를 넘을 때, 그것은 가격 트렌드가 상승에서 하락으로 전환되는 것을 나타냅니다. 이는 짧은 신호입니다.

이 전략은 또한 일부 거래 신호를 필터링하기 위해 가격 변동의 최대 및 최소 값을 결합합니다. 거래 신호는 가격 변동이 일정 정도에 도달 한 후에 만 시작됩니다. 이것은 일부 잘못된 신호를 어느 정도 필터링 할 수 있습니다.

구체적으로, 최대 및 최소 값이 도달되는 시간을 추적함으로써 전략은 가격 추세가 형성되었는지 여부를 판단합니다. 실제 거래 신호는 최대 또는 최소 값이 일정 기간 동안 지속된 후에 만 발동됩니다.

이점 분석

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 트렌드 방향을 결정하기 위해 EMA 라인을 사용하면 시장 움직임을 효과적으로 추적 할 수 있습니다.
  2. 다른 기간의 EMA 라인을 결합하면 중장기 거래 기회를 포착 할 수 있습니다.
  3. 극한 값에 의해 신호를 필터링하면 소음을 제거하고 거래 기회를 놓치지 않도록 할 수 있습니다.
  4. 논리는 간단하고 명확하고 이해하기 쉽고 수정하기 쉽습니다.
  5. 매개 변수들은 다양한 제품과 무역 선호도에 따라 조정될 수 있으며, 높은 적응력을 보여준다.

위험 분석

이 전략에는 몇 가지 위험도 있습니다.

  1. EMA 라인 자체는 지연 효과를 가지고 있으며, 단기 트렌드 전환을 놓칠 수 있습니다.
  2. 소음 필터링은 불완전합니다. 잘못된 거래가 발생할 수 있습니다.
  3. 매개 변수들은 다른 시장 환경에 맞게 적절하게 조정되어야 합니다.

위험은 다음을 통해 완화 될 수 있습니다.

  1. EMA 라인 지연 문제를 피하기 위해 신호 확인을 위한 다른 지표를 추가합니다.
  2. 신호 신뢰성을 향상시키기 위해 극한 값 필터링 조건을 최적화
  3. 전략 최적화를 위해 백테스트 결과에 기초한 매개 변수 조정

개선 을 위한 지침

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

  1. 신호의 정확성을 향상시키기 위해 MACD 및 KD와 같은 다른 기술 지표를 통합하십시오.
  2. 특정 제품에 더 적합한 EMA 라인 매개 변수를 최적화
  3. 가격 변동에 대한 더 나은 판단을 위해 극단적 가치 매개 변수를 정제합니다.
  4. 거래당 최대 손실을 제어하기 위해 스톱 로스 메커니즘을 추가합니다.
  5. 적응력을 평가하기 위해 다른 제품에 전략을 테스트하십시오.

요약

요약하자면, 이 EMA 크로스오버 전략은 단순하고 실용적인 트렌드 다음 전략이다. 주요 트렌드 방향을 결정하기 위해 EMA 라인을 사용하여 거래 결정을 내리기 위해 가격 변동 필터링과 결합합니다. 매개 변수를 이해하고 조정하기 쉽고 중장기 거래에 적응 할 수 있습니다. 추가 최적화로, 이것은 장기적으로 유지하는 가치있는 양적 전략이 될 수 있습니다.


/*backtest
start: 2024-01-15 00:00:00
end: 2024-01-22 00:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("PierceMAStrat", overlay=true)

lenMA0 = input(title="Length 0",defval=2)
lenMA1=input(title="Length 1",defval=10)
lenMA2=input(title="Length 2", defval=20)
lenMA3 = input(title = "Length3", defval =50)




emaLen0 = ema(close, lenMA0)
emaLen1 = ema(close, lenMA1)
emaLen2 = ema(close, lenMA2)
emaLen3 = ema(close, lenMA3)

    
ascent = if emaLen1[1] < emaLen1[0]
    true
else
    false
    
descent = if emaLen1[1] > emaLen1[0]
    true
else
    false
    
TimeSinceAscensionStart = if ascent == true
    barssince(descent == true)
else
    0
    

StartUp = if TimeSinceAscensionStart < 1
    true
else
    false

StartDown = if TimeSinceAscensionStart < 1
    false
else
    true


AscentBarCounter = barssince(StartUp == true)

DescentBarCounter = barssince(StartDown == true)

MaxAscent = if AscentBarCounter[1] > AscentBarCounter[0] and AscentBarCounter[1] > 10
    true
else
    false
    
MaxDescent = if DescentBarCounter[1] > DescentBarCounter[0] and DescentBarCounter[1] > 5
    true
else
    false
    
longCond = if crossover(emaLen1, emaLen2) and barssince(MaxDescent == true) > 3
    true
else
    false
shortCond = if crossunder(emaLen1, emaLen2) and barssince(MaxAscent == true) > 3
    true
else
    false


//longCond = (crossover(emaLen1, emaLen2) and (emaLen2 > emaLen3))
//shortCond = crossunder(emaLen1, emaLen2) and (emaLen2 < emaLen3)



if longCond == true
    strategy.entry("LONG", strategy.long)

if shortCond == true
    strategy.entry("SHORT", strategy.short)
    


plotshape(series=MaxAscent, title="MaximaReached", style=shape.triangledown, location=location.abovebar, color=green, text="MaximaReached", size=size.small)
plotshape(series=MaxDescent, title="MinimaReached", style=shape.triangleup, location=location.belowbar, color=red, text="MinimaReached", size=size.small)
//plotshape(series=StartUp, title="StartUp", style=shape.triangleup, location=location.belowbar, color=red, text="StartUp", size=size.tiny)
//plotshape(series=StartDown, title="StartDown", style=shape.triangleup, location=location.belowbar, color=green, text="StartDown", size=size.tiny)

//plotshape(series=(crossover(emaLen1, emaLen3)), title="GBXOVER", style=shape.triangleup, location=location.belowbar, color=green, text="GBXO", size=size.small)
//plotshape(series=(crossover(emaLen2, emaLen3)), title="RBXOVER", style=shape.triangledown, location=location.abovebar, color=orange, text="RBXO", size=size.small)
//plotshape(series=(crossover(emaLen1, emaLen2)), title="GRXOVER", style=shape.triangledown, location=location.abovebar, color=teal, text="GRXO", size=size.small)
//plotshape(series=(crossunder(emaLen1, emaLen2)), title="GRXUNDER", style=shape.triangledown, location=location.abovebar, color=purple, text="GRXU", size=size.small)
//plotshape(series=(crossunder(emaLen1, emaLen3)), title="GBXOVER", style=shape.triangleup, location=location.belowbar, color=yellow, text="GBXU", size=size.small)
//plotshape(series=(crossunder(emaLen2, emaLen3)), title="RBXOVER", style=shape.triangledown, location=location.abovebar, color=yellow, text="RBXU", size=size.small)
    
//plotshape(convergence, color=lime, style=shape.arrowup, text="CROSS")
plot(emaLen1, color=green, transp=0, linewidth=2)
plot(emaLen2, color=red, transp=30, linewidth=2)
plot(emaLen3, color=blue, transp=30, linewidth=2)



더 많은