이 전략은 다중 기술 지표에 기반한 정량 거래 시스템으로, 지수 이동 평균 ((EMA), 상대적으로 강한 지표 ((RSI) 및 평균 트렌드 지표 ((ADX) 의 3대 기술 지표를 통합한다. 전략은 EMA의 빠른 느린 선의 교차 신호를 주요 진입 근거로 하고, 동시에 RSI 지표와 결합하여 과도한 매매를 확인하고, ADX 지표를 이용하여 시장 경향의 강도를 판단하여 완전한 거래 의사 결정 시스템을 형성한다. 전략은 또한 위험 관리 모듈을 포함하고 있으며, 위험과 이익의 비율을 설정하여 각 거래의 중지 및 중지 위치를 제어한다.
이 전략의 핵심 논리는 다음과 같은 몇 가지 핵심 요소에 기반합니다.
이 전략은 합리적이고 논리적으로 설계된 다중 기술 지표 거래 전략이다. EMA, RSI, ADX 세 가지의 고전 기술 지표를 통합함으로써 전략은 추세 추적 및 위험 제어에서 좋은 성능을 발휘한다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-11 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Enhanced EMA + RSI + ADX Strategy", overlay=true)
// Input parameters
lenFast = input.int(9, title="Fast EMA Length", minval=1)
lenSlow = input.int(21, title="Slow EMA Length", minval=1)
rsiPeriod = input.int(14, title="RSI Period")
adxPeriod = input.int(14, title="ADX Period")
adxSmoothing = input.int(1, title="ADX Smoothing")
adxThreshold = input.int(20, title="ADX Threshold")
riskRewardRatio = input.float(2.0, title="Risk/Reward Ratio")
// EMA Calculations
fastEMA = ta.ema(close, lenFast)
slowEMA = ta.ema(close, lenSlow)
// RSI Calculation
rsiValue = ta.rsi(close, rsiPeriod)
// ADX Calculation
[plusDI, minusDI, adxValue] = ta.dmi(adxPeriod, adxSmoothing)
// Entry Conditions
buyCondition = ta.crossover(fastEMA, slowEMA) and rsiValue < 60 and adxValue > adxThreshold
sellCondition = ta.crossunder(fastEMA, slowEMA) and rsiValue > 40 and adxValue > adxThreshold
// Entry logic
if (buyCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Sell", from_entry="Buy", limit=close + (close - strategy.position_avg_price) * riskRewardRatio, stop=close - (close - strategy.position_avg_price))
if (sellCondition)
strategy.close("Buy")
// Plotting EMAs (thinner lines)
plot(fastEMA, color=color.new(color.green, 0), title="Fast EMA", linewidth=1)
plot(slowEMA, color=color.new(color.red, 0), title="Slow EMA", linewidth=1)
// Entry and exit markers (larger shapes)
plotshape(series=buyCondition, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.normal, title="Buy Signal")
plotshape(series=sellCondition, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.normal, title="Sell Signal")
// Displaying price labels for buy/sell signals
if (buyCondition)
label.new(bar_index, low, text="Buy\n" + str.tostring(close), color=color.new(color.green, 0), style=label.style_label_down, textcolor=color.white)
if (sellCondition)
label.new(bar_index, high, text="Sell\n" + str.tostring(close), color=color.new(color.red, 0), style=label.style_label_up, textcolor=color.white)
// Optional: Add alerts for entry signals
alertcondition(buyCondition, title="Buy Alert", message="Buy signal triggered")
alertcondition(sellCondition, title="Sell Alert", message="Sell signal triggered")