
EMA SAR에서의 장기 트렌드 추적 전략은 지수 이동 평균 ((EMA) 과 패러폴리 라인 지표 ((SAR) 의 조합을 사용하여 시장의 중장기 트렌드를 포착하는 양적 거래 전략이다. 이 전략은 20주기 EMA와 60주기 EMA를 비교하여 SAR 지표와 결합하여 현재 시장의 트렌드 방향을 결정하고, 트렌드가 확립된 후에 거래한다. 이 전략의 주요 목표는 트렌드 형성 초기 단계에서 개입하고, 트렌드 반전의 신호가 나타날 때까지 포지션을 보유하는 것이다.
이 전략의 핵심은 두 개의 다른 주기적 EMA ((20과 60) 의 교차를 사용하여 트렌드의 방향을 판단하는 것입니다. 20주기 EMA가 아래 방향에서 60주기 EMA를 통과하면 상승 트렌드가 형성되고 있음을 나타냅니다. 반대로 20주기 EMA가 위 방향에서 60주기 EMA를 통과하면 하향 트렌드가 형성되고 있음을 나타냅니다. 트렌드의 진실성을 추가로 확인하기 위해 이 전략은 SAR 지표를 보조 판단으로 도입했습니다.
EMA SAR에서 장기적인 트렌드 추적 전략은 EMA와 SAR 지표를 조합하여 트렌드 형성 초기 단계에서 개입하여 시장에서 장기적인 트렌드 기회를 포착합니다. 이 전략의 장점은 노이즈를 더 잘 필터링하고 트렌드가 확립된 후 이익을 극대화하기 위해 위치를 유지하는 것입니다. 그러나, 그것은 불안한 시장에서 더 많은 잘못된 신호가 발생할 수 있으며, 선택 지수의 영향을 더 많이 나타냅니다.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA SAR Strategy", overlay=true)
// EMA Settings
ema_20 = ta.ema(close, 20)
ema_60 = ta.ema(close, 60)
/// SAR Settings
sar = ta.sar(0.02, 0.2, 0.2)
sar_value = sar
is_trend_up = sar[1] > sar[2] ? true : false // Evaluating the trend direction
/// Condition for Buy Signal
buy_condition = ta.crossover(ema_20, ema_60) and (sar_value < ema_20) and (is_trend_up)
// Condition for Sell Signal
sell_condition = ta.crossunder(ema_20, ema_60) and (sar_value > ema_20) and (not is_trend_up)
// Define Entry Time
entry_time = time + 180000
// Strategy Entry
strategy.entry("Buy", strategy.long, when=buy_condition, comment="Buy Signal", stop=high[1])
strategy.entry("Sell", strategy.short, when=sell_condition, comment="Sell Signal", stop=low[1], when=entry_time)
// Plot EMAs
plot(ema_20, color=#f3e221, linewidth=1, title="EMA 20")
plot(ema_60, color=#8724f0, linewidth=1, title="EMA 60")
// Plot SAR
plotshape(sar_value, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.small, title="SAR Up")
plotshape(sar_value, style=shape.triangledown, location=location.belowbar, color=color.red, size=size.small, title="SAR Down")
// Plot Buy and Sell Signals
plotshape(series=buy_condition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=sell_condition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// Send Alerts
alertcondition(condition=buy_condition, title="Buy Signal", message="Buy Signal - EMA SAR Strategy")
alertcondition(condition=sell_condition, title="Sell Signal", message="Sell Signal - EMA SAR Strategy")