
この戦略は、二重指数移動平均 (EMA) とストキャスティクス オシレーターを組み合わせた定量取引システムです。 20 期間および 50 期間の EMA を使用して市場のトレンドを判断し、ストキャスティクス オシレーターを使用して買われすぎと売られすぎの領域で取引の機会を見つけ、トレンドと勢いの完璧な組み合わせを実現します。この戦略では、固定ストップロスと利益目標の設定を含む厳格なリスク管理措置を採用しています。
戦略のコアロジックは、トレンド判断、エントリータイミング、リスク管理の 3 つの部分に分かれています。トレンドの判断は主に高速EMA(20期間)と低速EMA(50期間)の相対的な位置に依存します。高速ラインが低速ラインより上にある場合は上昇トレンドと判断され、そうでない場合は下降トレンドと判断されます。 。エントリーシグナルはストキャスティクスオシレーターのクロスオーバーによって確認され、買われ過ぎと売られ過ぎの領域で高確率の取引機会を探します。リスク管理では、固定パーセンテージのストップロスと 2 倍の利益確定比率設定を使用して、各取引のリスクとリターンの比率が明確になるようにします。
この戦略は、トレンドとモメンタム指標を組み合わせて、完全な取引システムを作成します。この戦略の主な利点は、明確な論理フレームワークと厳格なリスク管理にありますが、実際の適用では、特定の市場状況に基づいてパラメータの最適化が依然として必要です。この戦略は継続的な改善と最適化を通じて、さまざまな市場環境において安定したパフォーマンスを維持することが期待されます。
/*backtest
start: 2024-12-06 00:00:00
end: 2025-01-04 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("EMA + Stochastic Strategy", overlay=true)
// Inputs for EMA
emaShortLength = input.int(20, title="Short EMA Length")
emaLongLength = input.int(50, title="Long EMA Length")
// Inputs for Stochastic
stochK = input.int(14, title="Stochastic %K Length")
stochD = input.int(3, title="Stochastic %D Smoothing")
stochOverbought = input.int(85, title="Stochastic Overbought Level")
stochOversold = input.int(15, title="Stochastic Oversold Level")
// Inputs for Risk Management
riskRewardRatio = input.float(2.0, title="Risk-Reward Ratio")
stopLossPercent = input.float(1.0, title="Stop Loss (%)")
// EMA Calculation
emaShort = ta.ema(close, emaShortLength)
emaLong = ta.ema(close, emaLongLength)
// Stochastic Calculation
k = ta.stoch(high, low, close, stochK)
d = ta.sma(k, stochD)
// Trend Condition
isUptrend = emaShort > emaLong
isDowntrend = emaShort < emaLong
// Stochastic Signals
stochBuyCrossover = ta.crossover(k, d)
stochBuySignal = k < stochOversold and stochBuyCrossover
stochSellCrossunder = ta.crossunder(k, d)
stochSellSignal = k > stochOverbought and stochSellCrossunder
// Entry Signals
buySignal = isUptrend and stochBuySignal
sellSignal = isDowntrend and stochSellSignal
// Strategy Execution
if buySignal
strategy.entry("Buy", strategy.long)
stopLoss = close * (1 - stopLossPercent / 100)
takeProfit = close * (1 + stopLossPercent * riskRewardRatio / 100)
strategy.exit("Take Profit/Stop Loss", from_entry="Buy", stop=stopLoss, limit=takeProfit)
if sellSignal
strategy.entry("Sell", strategy.short)
stopLoss = close * (1 + stopLossPercent / 100)
takeProfit = close * (1 - stopLossPercent * riskRewardRatio / 100)
strategy.exit("Take Profit/Stop Loss", from_entry="Sell", stop=stopLoss, limit=takeProfit)
// Plotting
plot(emaShort, color=color.blue, title="Short EMA")
plot(emaLong, color=color.red, title="Long EMA")