
この戦略は,複数の指数移動平均 ((EMA) の交差信号に基づく取引システムであり,異なる周期のEMA指標とATRの動的ストップメカニズムを組み合わせている.この戦略は,10周期,39周期,73周期のEMAを主要な信号指標として使用し,143周期の高時間周期EMAをトレンドフィルターとして導入し,ATRの指標の動的ストップと利益目標を設定している.
戦略の核心的な論理は,複数のEMAの交差信号とトレンド確認に基づいています. 短期EMA (10サイクル) が中期EMA (39サイクル) を向上して,価格が長期EMA (73サイクル) とより高い時間周期EMA (143サイクル) の上にあるとき,システムは多信号を生成します. 逆に,短期EMAが中期EMAを下向きに横切って,価格が長期EMAとより高い時間周期EMAの下にあるとき,システムは空信号を生成します. 戦略は,ATRの1倍をストップダストとして,2倍をリターンとして,リスクと利益の1:2のダイナミックポジション管理を実現します.
この戦略は,複数のEMAの交差を組み合わせてATRの動的ストップを用い,トレンド追跡とリスク管理を兼ね備えた取引システムを構築する.戦略の主要な優点は,複数の時間周期の確認機構と動的ポジション管理にあるが,横軸市場と後退性によるリスクにも注意する必要がある.取引量確認,トレンド強度フィルターなどの最適化手段を導入することにより,戦略の安定性と収益能力をさらに向上させることができる.実用的な応用では,異なる市場環境と取引品種の特性に応じてパラメータの適切な調整が推奨される.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Enhanced EMA Crossover Strategy", overlay=true)
// Define the EMA lengths
ema_short_length = 10
ema_long_length = 39
ema_filter_length = 73
ema_higher_tf_length = 143
// Calculate the EMAs
ema_short = ta.ema(close, ema_short_length)
ema_long = ta.ema(close, ema_long_length)
ema_filter = ta.ema(close, ema_filter_length)
ema_higher_tf = request.security(syminfo.tickerid, "D", ta.ema(close, ema_higher_tf_length))
// Calculate ATR for volatility-based stop loss and take profit
atr_length = 14
atr = ta.atr(atr_length)
// Plot the EMAs
plot(ema_short, title="EMA 10", color=color.blue)
plot(ema_long, title="EMA 35", color=color.red)
plot(ema_filter, title="EMA 75", color=color.orange)
plot(ema_higher_tf, title="EMA Higher TF", color=color.purple)
// EMA crossover conditions with EMA 75 and higher timeframe EMA filter
longCondition = ta.crossover(ema_short, ema_long) and close > ema_filter and close > ema_higher_tf
shortCondition = ta.crossunder(ema_short, ema_long) and close < ema_filter and close < ema_higher_tf
// Execute long trade with dynamic stop loss and take profit
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Long", limit=close + 2 * atr, stop=close - 1 * atr)
// Execute short trade with dynamic stop loss and take profit
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Short", limit=close - 2 * atr, stop=close + 1 * atr)
// Plot signals on the chart
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", text="BUY")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal", text="SELL")