4배 EMA 지표 거래 전략

저자:차오장, 날짜: 2023-09-12 14:51:28
태그:

이 전략은 서로 다른 매개 변수와 함께 네 개의 EMA 라인을 사용하여 기계적 거래에 대한 명확한 트렌드 추적 시스템을 형성합니다. 이중 EMA 크로스오버 방법을 사용하여 중장기 트렌드를 추적하는 것을 목표로합니다.

전략 논리:

  1. 두 개의 빠르고 느린 EMA 쌍을 계산합니다. 일반적으로 72 및 44 기간입니다.

  2. 빠른 EMA가 느린 EMA를 넘을 때 긴 거리로 가세요.

  3. 빠른 EMA가 느린 EMA를 넘을 때 짧습니다.

  4. 구매 및 판매 신호를 표시하기 위해 색을 사용하십시오.

  5. 신호를 실행하기 위해 정해진 기간 동안 백테스트

장점:

  1. 네 개의 EMA는 명확한 트렌드 패턴을 형성합니다.

  2. 빠른 / 느린 EMA 조합은 중장기 트렌드를 효과적으로 추적합니다.

  3. 크로스오버 규칙은 간단하고 과잉 거래를 피합니다.

위험성:

  1. EMA 지연은 트렌드 전환을 놓칠 수 있습니다.

  2. 단 한번의 거래에서 제한없는 손실을 의미합니다.

  3. 열악한 매개 변수는 과도한 신호 또는 불일치로 이어질 수 있습니다.

요약하자면, 4배 EMA 크로스오버 전략은 기계적 트렌드 트레이딩을 위해 빠른 / 느린 EMA 쌍을 사용합니다. 시각적 트레이더에 대한 시각적 인터페이스는 직관적입니다. 그러나 지연과 스톱의 부족은 장기적인 안정적인 이익을 위해 신중한 리스크 관리가 여전히 필요하다는 것을 의미합니다.


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

// strategy(title = "Cuathro EMA Strategy", shorttitle = "Cuathro EMA",initial_capital=1000, commission_value=0.2, commission_type =strategy.commission.percent, default_qty_value=100 , overlay = false, pyramiding=10, default_qty_type=strategy.percent_of_equity)
//@Moneros 2017
// based on OCC by @JayRogers
emaSlowPeriod    = input(defval = 44, title = "EMA Slow, always < EMA Fast - low short term, high long term ", minval = 1)
emaFastPeriod    = input(defval = 72, title = "EMA Fast - low short term, high long term ", minval = 1)
len    = input(defval = 14, title = "Period", minval = 1)
res = input(title="Resolution  - not lower than chart", defval="120")



closeSeries =  request.security(syminfo.tickerid, res, 2 * ta.ema(close, len) - ta.ema(ta.ema(close, len), len)  )
openSeries  = request.security(syminfo.tickerid,res, 2 * ta.ema(close[1], len) - ta.ema(ta.ema(close[1], len), len)  )


slowema = ta.ema(closeSeries - openSeries,emaSlowPeriod)
fastema = ta.ema(closeSeries - openSeries,emaFastPeriod)

plot(slowema, color=color.blue)
plot(fastema,color=color.red)


bgcolor(slowema< fastema ? color.red : na, transp=90)
bgcolor(slowema> fastema ? color.blue : na, transp=90)

bgcolor(ta.crossover(slowema, fastema) ? color.blue : na, transp=40)
bgcolor(ta.crossunder(slowema, fastema) ? color.red : na, transp=40)
strategy.order("BUY", strategy.long, 1, when = ta.crossover(slowema, fastema))
strategy.order("SELL", strategy.short, 1, when = ta.crossunder(slowema, fastema)) 


더 많은