
この戦略は,指数移動平均 ((EMA) 交差に基づくトレンド追跡システムで,ダイナミックなポジション管理とリスク管理を組み合わせている.戦略は,速いと遅いEMAの交差信号を使用して,市場のトレンドを識別し,同時に,パーセントリスク計算を使用して,取引規模を動的に調整し,移動ストップを使用して,利益を保護する.
戦略の核心的な論理は,2つの異なる周期の指数移動平均に基づいています (デフォルトは9と21). 急速なEMAが上向きにゆっくりとしたEMAを横切ると,システムは多信号を生成します. 急速なEMAが下向きにゆっくりとしたEMAを横切ると,システムは平仓します. 各取引の規模は,口座総資金の固定リスク比率 (デフォルトは1%) に基づいて動的に計算され,同時にリスクと報酬比率に基づくストップレベルと移動ストップの割合が設定されます.
これは,古典的な技術分析方法と現代的なリスク管理理念を組み合わせた完全な取引システムである.戦略は,ダイナミックなポジション管理と移動のストップを介してリスクを制御し,EMAの交差を利用してトレンドの機会をキャプチャします.いくつかの固有の限界があるものの,推奨された最適化の方向によって,戦略の安定性と適応性をさらに向上させることができます.
/*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=5
strategy("Bitcoin Exponential Profit Strategy", overlay=true)
// User settings
fastLength = input.int(9, title="Fast EMA Length", minval=1)
slowLength = input.int(21, title="Slow EMA Length", minval=1)
riskPercent = input.float(1, title="Risk % Per Trade", step=0.1) / 100
rewardMultiplier = input.float(2, title="Reward Multiplier (R:R)", step=0.1)
trailOffsetPercent = input.float(0.5, title="Trailing Stop Offset %", step=0.1) / 100
// Calculate EMAs
fastEMA = ta.ema(close, fastLength)
slowEMA = ta.ema(close, slowLength)
// Plot EMAs
plot(fastEMA, color=color.blue, title="Fast EMA")
plot(slowEMA, color=color.red, title="Slow EMA")
// Account balance and dynamic position sizing
capital = strategy.equity
riskAmount = capital * riskPercent
// Define Stop Loss and Take Profit Levels
stopLossLevel = close * (1 - riskPercent)
takeProfitLevel = close * (1 + rewardMultiplier * riskPercent)
// Trailing stop offset
trailOffset = close * trailOffsetPercent
// Entry Condition: Bullish Crossover
if ta.crossover(fastEMA, slowEMA)
positionSize = riskAmount / math.max(close - stopLossLevel, 0.01) // Prevent division by zero
strategy.entry("Long", strategy.long, qty=positionSize)
strategy.exit("TakeProfit", from_entry="Long", stop=stopLossLevel, limit=takeProfitLevel, trail_offset=trailOffset)
// Exit Condition: Bearish Crossunder
if ta.crossunder(fastEMA, slowEMA)
strategy.close("Long")
// Labels for Signals
if ta.crossover(fastEMA, slowEMA)
label.new(bar_index, low, "BUY", color=color.green, textcolor=color.white, style=label.style_label_up)
if ta.crossunder(fastEMA, slowEMA)
label.new(bar_index, high, "SELL", color=color.red, textcolor=color.white, style=label.style_label_down)