
Die DCA-Strategie ist eine quantitative Trading-Strategie, die auf einer doppelten Linearkreuzung und der DCA basiert. Die Strategie verwendet einen einfachen Moving Average (SMA) aus zwei verschiedenen Perioden als Kauf- und Verkaufssignal, während die DCA-Methode die Kaufkosten senkt.
Die DCA-Strategie ist einfach in der Logik und hat eine breite Palette von Anwendungsbereichen, wobei jedoch auf Optimierungsparameter und Risikokontrollen in der praktischen Anwendung geachtet werden muss. Durch die Einführung weiterer technischer Kennzahlen, die Optimierung der DCA-Parameter und die Aufnahme eines Stop-Loss-Stopp-Mechanismus können die Performance und Stabilität der Strategie weiter verbessert werden.
/*backtest
start: 2024-04-21 00:00:00
end: 2024-04-28 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © loggolitasarim
//@version=5
strategy("DCA YSMA HSMA Stratejisi", overlay=true, calc_on_every_tick=true)
// Parametreler
sma_fast = input(14, "Hızlı SMA Dönemi")
sma_slow = input(28, "Yavaş SMA Dönemi")
dca_amount = input(100, "DCA Miktarı")
dca_interval = input(14, "DCA Aralığı (Gün)")
// Hızlı ve yavaş SMA hesaplamaları
fast_sma = ta.sma(close, sma_fast)
slow_sma = ta.sma(close, sma_slow)
// DCA hesaplamaları
var float dca_average_price = na
var int dca_count = na
if (bar_index % dca_interval == 0)
dca_count := nz(dca_count, 0) + 1
dca_average_price := nz(dca_average_price, close) * (dca_count - 1) + close
dca_average_price /= dca_count
// Alım ve satım sinyalleri
longCondition = ta.crossover(fast_sma, slow_sma)
shortCondition = ta.crossunder(fast_sma, slow_sma)
if (longCondition)
strategy.entry("Alım", strategy.long, qty=dca_amount)
if (shortCondition)
strategy.entry("Satım", strategy.short)
// Grafik
plot(fast_sma, "Hızlı SMA", color=color.blue)
plot(slow_sma, "Yavaş SMA", color=color.red)
// Uyarılar
alertcondition(longCondition, "Alım Sinyali", "Alım Sinyali")
alertcondition(shortCondition, "Satım Sinyali", "Satım Sinyali")