빠르고 느린 EMA 골든 크로스 돌파구 전략

저자:차오장, 날짜: 2023-12-01 18:02:24
태그:

img

전반적인 설명

빠른 및 느린 EMA 황금 십자 돌파 전략은 시장 트렌드를 추적하는 간단하고 효과적인 전략입니다. 구매 및 판매 신호를 생성하기 위해 다른 주기의 EMA의 크로스오버를 사용합니다. 기본 아이디어는: 짧은 주기의 EMA가 더 긴 주기의 EMA를 넘을 때 구매 신호가 생성됩니다. 짧은 주기의 EMA가 더 긴 주기의 EMA를 넘을 때 판매 신호가 생성됩니다.

전략 원칙

이 전략은 주로 5주기, 8주기 및 13주기 EMA를 비교하여 거래 신호를 생성합니다.

  1. 5주기 EMA, 8주기 EMA 및 13주기 EMA를 계산합니다.
  2. 5주기 EMA가 8주기 및 13주기 EMA를 넘으면 구매 신호가 생성됩니다.
  3. 5주기 EMA가 8주기 및 13주기 EMA를 넘으면 판매 신호가 생성됩니다.
  4. 동시에 ADX 지표를 결합하여 트렌드 강도를 결정하십시오. 트렌드가 신호를 생성 할만큼 강할 때만.

이것은 중장기 트렌드를 추적하는 효과를 실현합니다. 단기 순환 이동 평균이 긴 순환 이동 평균을 넘을 때, 단기 트렌드가 상승세를 보이며 구입할 수 있음을 의미합니다. 단기 순환 이동 평균이 긴 순환 이동 평균을 넘을 때, 단기 트렌드가 하락세를 보이며 판매되어야한다는 것을 의미합니다.

이점 분석

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

  1. 간단한 동작, 실행하기 쉽습니다.
  2. 동향을 효과적으로 추적하기 위해 EMA의 평형 효과를 최대한 활용하십시오.
  3. 여러 EMA 조합은 잘못된 신호를 피하기 위해 크로스오버를 구현합니다.
  4. ADX 표시기와 결합하면 신호가 더 신뢰할 수 있습니다.
  5. 상대적으로 낮은 마취율과 최대 감소율

위험 분석

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

  1. 트렌드가 급격히 역전될 때 스톱 로스는 더 커질 수 있습니다. 스톱 로스 범위는 적절하게 느려질 수 있습니다.
  2. 높은 거래 빈도는 거래 비용을 증가시킬 수 있습니다. 거래 빈도를 줄이기 위해 EMA 매개 변수를 적절히 조정할 수 있습니다.

최적화 방향

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

  1. EMA 매개 변수를 최적화해서 최적의 매개 변수 조합을 찾습니다.
  2. 신호 품질을 향상시키기 위해 KDJ, BOLL 등 필터링을 위한 다른 지표를 추가합니다.
  3. 리스크 통제를 최적화하기 위해 위치 관리를 조정합니다.
  4. 기계 학습 방법을 사용하여 더 나은 입출입 규칙을 찾습니다.

요약

요약하자면, 빠르고 느린 EMA 황금 십자 돌파 전략의 작동은 원활하며, 신호는 더 신뢰할 수 있으며, 마감률은 높지 않으며 중장기 트렌드를 추적하는 데 적합합니다. 매개 변수 최적화와 개선된 규칙으로 더 나은 전략 결과를 얻을 수 있습니다.


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

//@version=4
// 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gregoirejohnb
// @It is modified by ttsaadet.
// Moving average crossover systems measure drift in the market. They are great strategies for time-limited people.
// So, why don't more people use them?
// 

//
strategy(title="EMA Crossover Strategy by TTS", shorttitle="EMA-5-8-13 COS by TTS", overlay=true, pyramiding=0, default_qty_type=strategy.percent_of_equity, default_qty_value=100, currency=currency.TRY,commission_type=strategy.commission.percent,commission_value=0.04, process_orders_on_close = true, initial_capital = 100000)

// === GENERAL INPUTS ===
//strategy start date
start_year = input(defval=2020, title="Backtest Start Year")

// === LOGIC ===
short_period = input(type=input.integer,defval=5,minval=1,title="Length")
mid_period = input(type=input.integer,defval=8,minval=1,title="Length")
long_period = input(type=input.integer,defval=13,minval=1,title="Length")
rsi_period = input(type=input.integer,defval=14,minval=1,title="Length")
longOnly = input(type=input.bool,defval=false,title="Long Only")
shortEma = ema(close,short_period)
midEma = ema(close,mid_period)
longEma = ema(close,long_period)

rsi = rsi(close, rsi_period)

[diplus, diminus, adx] = dmi(short_period, short_period)
plot(shortEma,linewidth=2,color=color.red,title="Fast")
plot(midEma,linewidth=2,color=color.orange,title="Fast")
plot(longEma,linewidth=2,color=color.blue,title="Slow")

longEntry = crossover(shortEma,midEma) and crossover(shortEma,longEma) //or ((shortEma > longEma) and crossover(shortEma,midEma)))and (adx > 25)
shortEntry =((shortEma < midEma) and crossunder(shortEma,longEma)) or ((shortEma < longEma) and crossunder(shortEma,midEma))

plotshape(longEntry ? close : na,style=shape.triangleup,color=color.green,location=location.belowbar,size=size.small,title="Long Triangle")
plotshape(shortEntry and not longOnly ? close : na,style=shape.triangledown,color=color.red,location=location.abovebar,size=size.small,title="Short Triangle")
plotshape(shortEntry and longOnly ? close : na,style=shape.xcross,color=color.black,location=location.abovebar,size=size.small,title="Exit Sign")

// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() =>
    longEntry and 
       time > timestamp(start_year, 1, 1, 01, 01)
exitLong() =>
    crossunder(shortEma,longEma) or crossunder(close, longEma)

strategy.entry(id="Long", long=strategy.long, when=enterLong())
strategy.close(id="Long", when=exitLong())


// === STRATEGY - SHORT POSITION EXECUTION ===

enterShort() =>
    not longOnly and shortEntry and 
       time > timestamp(start_year, 1, 1, 01, 01)
exitShort() =>
    crossover(shortEma,longEma)

strategy.entry(id="Short", long=strategy.short, when=enterShort())
strategy.close(id="Short", when=exitShort())

더 많은