
この戦略は,複数の指数移動平均 ((EMA) と実際の波動幅 ((ATR) に基づくトレンド追跡取引システムである.この戦略は,20周期,50周期,および100周期の3つのEMAの協調的な配合によって市場トレンドを捉え,ATRを利用して,ダイナミックなリスク管理と利益目標を設定する.この方法は,取引の体系性を保証するとともに,リスクのダイナミックな制御を実現する.
戦略の核心的な論理は,価格と複数のEMAの間の相互作用に基づいています.具体的には:
この戦略は,多重均線システムとATRダイナミック・ウィンドコントロールの組み合わせにより,トレンド追跡と波段操作の特徴を兼ね備えた取引システムを構築している.戦略の優点は,システム的に強みがあり,リスクが制御可能であることである.しかし,実際のアプリケーションでは,市場環境の適応性に注意を払い,実際の状況に応じてターゲティング・最適化を行う必要がある.合理的なパラメータ設定と厳格なリスク管理により,この戦略は,ほとんどの市場環境で安定した取引効果を期待されている.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("EMA Swing Strategy with ATR", overlay=true)
// Inputs
emaShort = input.int(20, "Short EMA")
emaMid = input.int(50, "Mid EMA")
emaLong = input.int(100, "Long EMA")
rrRatio = input.float(1.5, "Risk-Reward Ratio")
contracts = input.int(5, "Number of Contracts")
// Calculations
ema20 = ta.ema(close, emaShort)
ema50 = ta.ema(close, emaMid)
ema100 = ta.ema(close, emaLong)
atr = ta.atr(14)
// Conditions
longCondition = ta.crossover(close, ema20) and close > ema50
shortCondition = ta.crossunder(close, ema20) and close < ema50
// Variables for trades
var float entryPrice = na
var float stopLoss = na
var float takeProfit = na
// Long Trades
if (longCondition)
entryPrice := close
stopLoss := close - atr
takeProfit := close + atr * rrRatio
strategy.entry("Long", strategy.long, contracts)
strategy.exit("Exit Long", from_entry="Long", stop=stopLoss, limit=takeProfit)
// Short Trades
if (shortCondition)
entryPrice := close
stopLoss := close + atr
takeProfit := close - atr * rrRatio
strategy.entry("Short", strategy.short, contracts)
strategy.exit("Exit Short", from_entry="Short", stop=stopLoss, limit=takeProfit)
// Plot EMAs
plot(ema20, color=color.green, title="EMA 20")
plot(ema50, color=color.red, title="EMA 50")
plot(ema100, color=color.white, title="EMA 100")
// Visualization for Entries
plotshape(series=longCondition, style=shape.labelup, color=color.green, location=location.belowbar, title="Long Entry")
plotshape(series=shortCondition, style=shape.labeldown, color=color.red, location=location.abovebar, title="Short Entry")