
この戦略は,スーパートレンド指標に基づく自動取引システムで,価格とスーパートレンドラインの交差を分析して取引信号を生成する.この戦略は,固定されたATR周期と倍数パラメータを使用して,価格のスーパートレンドラインの横断方向と組み合わせて市場トレンドを決定し,トレンド追跡と資金管理の有機的な組み合わせを実現する.
戦略の核心は,ATR (Average True Range) 変動率指標に基づいて構築されたSuperTrend指標を利用することです.具体的には以下のような実装があります.
これは,構造が明確で,論理が厳格なトレンド追跡戦略である.SuperTrend指標のダイナミックな特性により,トレンドキャプチャとリスク管理の統一が実現されている.戦略は,強力な実用性と拡張性があり,合理的なパラメータ設定と最適化方向の実施により,実際の取引で安定したパフォーマンスを期待されている.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Commodity KIng", overlay=true)
// Supertrend Parameters
atr_period = 10 // Fixed ATR Period
atr_multiplier = 2.0 // Fixed ATR Multiplier
// Calculate Supertrend
[supertrend, direction] = ta.supertrend(atr_multiplier, atr_period)
// Plot Supertrend with reversed colors
plot(supertrend, color=direction > 0 ? color.red : color.green, title="Supertrend", linewidth=2)
// Buy and Sell Conditions
longCondition = ta.crossover(close, supertrend) // Buy when price crosses above Supertrend
shortCondition = ta.crossunder(close, supertrend) // Sell when price crosses below Supertrend
// Execute Buy and Sell Orders
if (longCondition)
strategy.entry("Buy", strategy.long)
if (shortCondition)
strategy.entry("Sell", strategy.short)
// Exit Conditions
if (shortCondition)
strategy.close("Buy") // Close long position if price crosses below Supertrend
if (longCondition)
strategy.close("Sell") // Close short position if price crosses above Supertrend
// Alerts
if (longCondition)
alert("Buy Signal: " + str.tostring(close), alert.freq_once_per_bar)
if (shortCondition)
alert("Sell Signal: " + str.tostring(close), alert.freq_once_per_bar)