
この戦略は,複数の時間枠分析を組み合わせたトレンド追跡取引システムで,指数移動平均 ((EMA),平均トレンド指数 ((ADX) と相対強い指数 ((RSI) など,複数の技術指標を統合して,15分間の時間枠で取引します.戦略は,保守的なポジション管理方法を採用し,各取引のリスクは,長期的に安定した収益を達成するために,口座総額の2%以内で管理されます.
戦略は,急速なEMA ((50サイクル) と遅いEMA ((200サイクル) の交差点を使用してトレンドの方向を識別し,ADX指標と組み合わせてトレンドの強さを確認する.ADX値は25を超えると,市場が強いトレンド状態にあることを示している.RSI指標は,RSI値が70に達すると平仓多頭,RSI値が30に達すると平仓空頭である超買い超売り状態を識別するために使用される.同時に,戦略は,4時間の時間枠にEMA指標を導入し,取引の正確性を向上させるために,より高いレベルのトレンド確認として使用します.
この戦略は,多次元的な技術分析方法と厳格なリスク制御により,取引の良き潜在性を示しています.反測では安定したパフォーマンスを示していますが,実際の環境で充分な検証が必要です.戦略のモジュール化設計により,強力な適応性と最適化スペースがあり,市場の変化に応じて柔軟に調整できます.
/*backtest
start: 2024-02-20 00:00:00
end: 2025-02-18 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
*/
//@version=5
strategy("DOGE Enhanced Trend Following Strategy",
overlay=true,
default_qty_type=strategy.percent_of_equity,
default_qty_value=5,
commission_value=0.1,
slippage=2)
// === INPUT PARAMETERS ===
emaFastLength = input(50, title="Fast EMA Length")
emaSlowLength = input(200, title="Slow EMA Length")
adxLength = input.int(14, title="ADX Length")
adxSmoothing = input.int(14, title="ADX Smoothing Factor")
adxThreshold = input.float(25, title="ADX Trend Strength Threshold")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.float(70, title="RSI Overbought Level")
rsiOversold = input.float(30, title="RSI Oversold Level")
takeProfitMultiplier = input.float(1.03, title="Take Profit Multiplier", tooltip="Set a dynamic take profit level, e.g., 1.03 = 3% profit")
stopLossMultiplier = input.float(0.97, title="Stop Loss Multiplier", tooltip="Set stop loss level, e.g., 0.97 = 3% below entry price")
// === INDICATOR CALCULATIONS ===
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
[dip, dim, adxValue] = ta.dmi(adxLength, adxSmoothing)
rsiValue = ta.rsi(close, rsiLength)
// === MULTI-TIMEFRAME CONFIRMATION ===
emaFastHTF = request.security(syminfo.tickerid, "240", ta.ema(close, emaFastLength))
emaSlowHTF = request.security(syminfo.tickerid, "240", ta.ema(close, emaSlowLength))
// === CONDITIONS FOR TRADE ENTRY ===
bullishTrend = ta.crossover(emaFast, emaSlow) and adxValue > adxThreshold and rsiValue > rsiOversold
bearishTrend = ta.crossunder(emaFast, emaSlow) and adxValue > adxThreshold and rsiValue < rsiOverbought
// === TRADE EXECUTION ===
if (bullishTrend)
strategy.entry("Long", strategy.long)
strategy.exit("TakeProfit_Long", from_entry="Long", limit=close * takeProfitMultiplier, stop=close * stopLossMultiplier)
if (bearishTrend)
strategy.entry("Short", strategy.short)
strategy.exit("TakeProfit_Short", from_entry="Short", limit=close * (2 - takeProfitMultiplier), stop=close * (2 - stopLossMultiplier))
// === VISUAL INDICATORS AND PLOTTING ===
plot(emaFast, color=color.blue, linewidth=2, title="Fast EMA")
plot(emaSlow, color=color.red, linewidth=2, title="Slow EMA")
hline(adxThreshold, "ADX Threshold", color=color.gray, linestyle=hline.style_dotted)
bgcolor(bullishTrend ? color.new(color.green, 85) : bearishTrend ? color.new(color.red, 85) : na)
// === ALERTS ===
alertcondition(bullishTrend, title="Buy Signal", message="Bullish trend detected. Consider entering a long position.")
alertcondition(bearishTrend, title="Sell Signal", message="Bearish trend detected. Consider entering a short position.")
// === STRATEGY SETTINGS FOR REALISTIC TESTING ===
strategy.close("Long", when=rsiValue > rsiOverbought, comment="Exit Long on RSI Overbought")
strategy.close("Short", when=rsiValue < rsiOversold, comment="Exit Short on RSI Oversold")