
이 전략은 다중 이동 평균(SMA) 교차 신호를 기반으로 하는 양적 거래 시스템입니다. 이 모델은 20일, 50일, 200일의 세 가지 단순 이동 평균을 종합적으로 활용하고 이동 평균 교차 신호와 가격 포지션 간의 관계를 파악하여 시장 추세 변화와 잠재적인 거래 기회를 파악합니다. 이 전략은 단기 및 중기 이동 평균의 교차 신호를 고려할 뿐만 아니라 장기 이동 평균을 추세 필터로 사용하여 거래 품질을 효과적으로 개선합니다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이는 완전한 구조와 명확한 논리를 갖춘 다중 이동 평균 거래 전략입니다. 다양한 기간의 이동 평균을 종합적으로 활용하고 이를 가격 포지션 관계와 결합하면 이 전략을 통해 시장 추세의 변화를 더 잘 포착할 수 있습니다. 특정 지연과 시장 변동성 위험이 있기는 하지만, 이 전략은 적절한 매개변수 설정과 신호 필터링을 통해 여전히 좋은 실질적 가치를 가지고 있습니다. 앞으로 더 많은 기술 지표를 도입하고 신호 생성 메커니즘을 최적화함으로써 전략의 안정성과 신뢰성이 더욱 향상될 수 있습니다.
/*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)