
この戦略は,指数移動平均 ((EMA),相対的に強い指標 ((RSI) と平均トレンド指標 ((ADX) の3つの技術指標を統合した,複数の技術指標に基づいた量化取引システムである.この戦略は,EMAの高速・遅い線の交差信号を主要な入場根拠として使用し,RSIの指標と組み合わせて,過買買の確認を行い,ADXの指標を使用して市場の傾向の強さを判断し,完全な取引意思決定システムを形成する.この戦略には,リスク管理モジュールが含まれ,リスクと利益の比率を設定することで,各取引のストップとストップポジションを制御する.
戦略の核心的な論理は,以下の重要な要素に基づいています.
これは,合理的で論理的に設計された複数の技術指標の取引戦略である.EMA,RSI,ADXの3つのクラシック技術指標を統合することによって,戦略はトレンド追跡とリスク管理の面で良好なパフォーマンスを発揮している.いくつかの最適化が必要な場所があるが,全体的にこの戦略は,優れた実用価値と拡張スペースを持っています.
/*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")