
この戦略は、複数の移動平均 (SMA) クロスオーバー信号に基づく定量取引システムです。 20 日、50 日、200 日という異なる期間の 3 つの単純移動平均を総合的に使用し、移動平均のクロスオーバー信号と価格ポジションの関係を捉えることで、市場トレンドの変化と潜在的な取引機会を特定します。この戦略は、短期および中期移動平均のクロスオーバー信号を考慮するだけでなく、長期移動平均をトレンドフィルターとして使用して、取引の品質を効果的に向上させます。
戦略の中核となるロジックは、次の主要な要素に基づいています。
これは、完全な構造と明確なロジックを備えた複数の移動平均取引戦略です。異なる期間の移動平均を総合的に使用し、価格ポジション関係と組み合わせることで、この戦略は市場動向の変化をより適切に捉えることができます。一定の遅延と市場変動リスクはあるものの、この戦略は、合理的なパラメータ設定とシグナルフィルタリングを通じて、依然として優れた実用的価値を持っています。将来的には、より多くのテクニカル指標を導入し、シグナル生成メカニズムを最適化することで、戦略の安定性と信頼性をさらに向上させることができます。
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-25 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SMA 20/50/200 Strateji", overlay=true)
// SMA Periyotlarını, renklerini ve çizgi kalınlıklarını özelleştirme
sma20_period = input.int(20, title="SMA 20 Periyodu", minval=1)
sma50_period = input.int(50, title="SMA 50 Periyodu", minval=1)
sma200_period = input.int(200, title="SMA 200 Periyodu", minval=1)
sma20_color = input.color(color.blue, title="SMA 20 Rengi")
sma50_color = input.color(color.orange, title="SMA 50 Rengi")
sma200_color = input.color(color.red, title="SMA 200 Rengi")
sma20_width = input.int(2, title="SMA 20 Kalınlığı", minval=1, maxval=5)
sma50_width = input.int(2, title="SMA 50 Kalınlığı", minval=1, maxval=5)
sma200_width = input.int(2, title="SMA 200 Kalınlığı", minval=1, maxval=5)
// SMA Hesaplamaları
sma20 = ta.sma(close, sma20_period)
sma50 = ta.sma(close, sma50_period)
sma200 = ta.sma(close, sma200_period)
// Al ve Sat Koşulları
buyCondition = ta.crossover(sma20, sma50) and close > sma200
sellCondition = ta.crossunder(sma20, sma50) and close < sma200
buyCondition_50_200 = ta.crossover(sma50, sma200)
sellCondition_50_200 = ta.crossunder(sma50, sma200)
// Grafik üzerine SMA çizimleri
plot(sma20, color=sma20_color, linewidth=sma20_width, title="SMA 20")
plot(sma50, color=sma50_color, linewidth=sma50_width, title="SMA 50")
plot(sma200, color=sma200_color, linewidth=sma200_width, title="SMA 200")
// Al-Sat Stratejisi
if buyCondition
strategy.entry("Buy", strategy.long)
label.new(bar_index, low, "BUY", style=label.style_label_up, color=color.new(color.green, 0), textcolor=color.white)
if sellCondition
strategy.close("Buy")
label.new(bar_index, high, "SELL", style=label.style_label_down, color=color.new(color.red, 0), textcolor=color.white)
if buyCondition_50_200
label.new(bar_index, low, "50/200 BUY", style=label.style_label_up, color=color.new(color.blue, 0), textcolor=color.white)
if sellCondition_50_200
label.new(bar_index, high, "50/200 SELL", style=label.style_label_down, color=color.new(color.orange, 0), textcolor=color.white)
// Performans Görselleştirmesi İçin Arka Plan Rengi
bgColor = buyCondition ? color.new(color.green, 90) : sellCondition ? color.new(color.red, 90) : na
bgcolor(bgColor)