
이 전략은 다중 지수 이동 평균 (EMA) 에 기반한 트렌드 추적 및 역전 거래 전략으로, 다른 기간의 EMA의 상대적 위치를 분석하여 시장의 흐름을 식별하고 거래 신호를 생성합니다. 전략은 3개의 다른 기간의 지수 이동 평균 (EMA) 을 활용하여 (10주기, 20주기 및 30주기) 트레이딩 의사 결정 프레임워크를 구축합니다.
전략의 핵심은 다음과 같은 핵심 단계에 기반합니다.
다중 지수 이동 평균 트렌드 역전 거래 전략은 정교한 EMA 분석을 통해 동적이고 상대적으로 안정적인 트렌드 거래 방법을 제공합니다. 전략의 핵심은 트렌드 전환점을 포착하고 다중 주기 EMA의 상대적인 관계를 기반으로 거래 결정을 내리는 것입니다. 약간의 위험이 있음에도 불구하고 지속적인 최적화와 위험 관리를 통해 전략의 안정성과 수익성을 크게 향상시킬 수 있습니다.
/*backtest
start: 2025-01-01 00:00:00
end: 2025-03-31 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("Perfect Order Strategy", overlay=true)
// User input - EMA periods
aPeriod = input.int(10, "EMA A Period", minval=1)
bPeriod = input.int(20, "EMA B Period", minval=1)
cPeriod = input.int(30, "EMA C Period", minval=1)
// User input - EMA colors
colorA = input.color(color.red, "EMA A Color")
colorB = input.color(color.orange, "EMA B Color")
colorC = input.color(color.aqua, "EMA C Color")
// User input - Label colors
upTColor = input.color(color.red, "UP-T Color")
downTColor = input.color(color.aqua, "Down-T Color")
endColor = input.color(color.black, "End Color")
// Calculate EMAs
emaA = ta.ema(close, aPeriod)
emaB = ta.ema(close, bPeriod)
emaC = ta.ema(close, cPeriod)
// Plot EMAs on the chart
plot(emaA, title="EMA A", color=colorA, linewidth=1)
plot(emaB, title="EMA B", color=colorB, linewidth=1)
plot(emaC, title="EMA C", color=colorC, linewidth=1)
// Condition checks
condition1 = emaA > emaB and emaB > emaC // Uptrend condition
condition2 = emaA < emaB and emaB < emaC // Downtrend condition
// Variables for state management
var bool wasCondition1 = false
var bool wasCondition2 = false
var bool endDisplayed = false // Control for displaying "End" label
// Label display logic and trade signals
if condition1 and not wasCondition1
label.new(bar_index, high, "UP-T", color=upTColor, textcolor=color.white, style=label.style_label_down)
strategy.entry("Long", strategy.long) // Enter long on "UP-T"
wasCondition1 := true
wasCondition2 := false
endDisplayed := false
else if condition2 and not wasCondition2
label.new(bar_index, low, "Down-T", color=downTColor, textcolor=color.black, style=label.style_label_up)
strategy.entry("Short", strategy.short) // Enter short on "Down-T"
wasCondition2 := true
wasCondition1 := false
endDisplayed := false
else if (not condition1 and wasCondition1) or (not condition2 and wasCondition2)
if not endDisplayed
label.new(bar_index, high, "End", color=endColor, textcolor=color.white, style=label.style_label_down)
strategy.close_all() // Close all positions on "End"
endDisplayed := true
wasCondition1 := false
wasCondition2 := false
else if not condition1 and not condition2
wasCondition1 := false
wasCondition2 := false
endDisplayed := false