
Bei der Strategie handelt es sich um ein Trendfolgesystem auf Basis des Indikators QQE (Quick Quiet Exponent), kombiniert mit einem dynamischen Risikomanagementmechanismus. Der Kern der Strategie besteht darin, Markttrends durch die Schnittstelle zwischen der schnellen und langsamen QQE-Linie zu erfassen und ATR (Average True Range) zu verwenden, um Stop-Loss- und Take-Profit-Positionen dynamisch anzupassen und so eine optimale Risiko-Rendite-Konfiguration zu erreichen. Die Strategie umfasst außerdem Funktionen zum Kontorisikomanagement und zur Positionskontrolle, die die Anzahl offener Positionen automatisch basierend auf dem Kontokapital anpassen können.
Die Strategie umfasst im Wesentlichen drei Kernmodule: Signalgenerierung, Risikomanagement und Positionskontrolle. Das Modul zur Signalgenerierung basiert auf dem QQE-Indikator. Es berechnet den exponentiellen gleitenden Durchschnitt (EMA) von RSI, um die schnelle Linie (QQEF) zu erhalten, und berechnet die langsame Linie (QQES) in Kombination mit ATRRSI. Wenn QQEF QQES nach oben kreuzt, wird ein langes Signal erzeugt, und wenn es nach unten kreuzt, wird ein kurzes Signal erzeugt. Das Risikomanagementmodul verwendet ATR zur dynamischen Berechnung von Stop-Loss- und Take-Profit-Positionen und wendet einen Trailing-Stop-Loss-Mechanismus zum Schutz von Gewinnen an. Das Positionskontrollmodul berechnet die Anzahl der offenen Positionen basierend auf dem voreingestellten Risikoprozentsatz und dem aktuellen Kontokapital.
Diese Strategie realisiert die organische Kombination aus Trendverfolgung und Risikomanagement, indem sie den QQE-Indikator in ein komplettes Handelssystem umwandelt. Die Strategie ist sinnvoll konzipiert und weist eine hohe Praktikabilität und Skalierbarkeit auf. Durch eine sinnvolle Parameteroptimierung und Risikokontrolle kann die Strategie in verschiedenen Marktumgebungen eine stabile Performance aufrechterhalten. Es wird Händlern empfohlen, bei der Verwendung im realen Handel ausreichend Backtests und Parameteroptimierungen durchzuführen.
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-16 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © seckinduran
//@version=5
strategy("QQE Strategy with Risk Management", overlay=true)
// Girdi Parametreleri
src = input(close, title="Source")
length = input.int(14, title="RSI Length", minval=1)
SSF = input.int(5, title="SF RSI Smoothing Factor", minval=1)
riskPercentage = input.float(1.0, title="Risk Percentage per Trade", minval=0.1, maxval=10.0)
// Trailing Stop ve Stop Loss Parametreleri
stopLossMultiplier = input.float(title="Stop Loss Katsayısı", defval=1.5)
takeProfitMultiplier = input.float(title="Take Profit Katsayısı", defval=3)
trailStopMultiplier = input.float(title="Trailing Stop Katsayısı", defval=1.5)
// QQE Hesaplamaları
RSII = ta.ema(ta.rsi(src, length), SSF)
TR = math.abs(RSII - RSII[1])
wwalpha = 1 / length
WWMA = ta.ema(TR, length)
ATRRSI = ta.ema(WWMA, length)
QQEF = ta.ema(ta.rsi(src, length), SSF)
QUP = QQEF + ATRRSI * 4.236
QDN = QQEF - ATRRSI * 4.236
QQES = 0.0
QQES := QUP < nz(QQES[1]) ? QUP : QQEF > nz(QQES[1]) and QQEF[1] < nz(QQES[1]) ? QDN : QDN > nz(QQES[1]) ? QDN : QQEF < nz(QQES[1]) and QQEF[1] > nz(QQES[1]) ? QUP : nz(QQES[1])
// Çizgileri Görselleştirme
plot(QQEF, "FAST", color=color.maroon, linewidth=2)
plot(QQES, "SLOW", color=color.blue, linewidth=1)
// Alım ve Satım Koşulları
longCondition = ta.crossover(QQEF, QQES) // Hızlı çizgi yavaş çizgiyi yukarı keserse
shortCondition = ta.crossunder(QQEF, QQES) // Hızlı çizgi yavaş çizgiyi aşağı keserse
// ATR Hesaplaması
atrValue = ta.atr(14) // ATR hesaplaması burada
// Pozisyon Büyüklüğü Hesaplama
tradeSize = strategy.equity / close
riskSize = (strategy.equity * riskPercentage / 100) / close
leverageSize = math.max(1, riskSize) // Negatif değerleri engellemek için doğrulama
// Pozisyon Açma
if (longCondition)
strategy.entry("Buy", strategy.long, qty=leverageSize, stop=close - (atrValue * stopLossMultiplier), limit=close + (atrValue * takeProfitMultiplier), comment="Long Entry")
if (shortCondition)
strategy.entry("Sell", strategy.short, qty=leverageSize, stop=close + (atrValue * stopLossMultiplier), limit=close - (atrValue * takeProfitMultiplier), comment="Short Entry")
// Çıkış Koşulları: Trailing Stop
if (strategy.position_size > 0)
strategy.exit("Trail Exit Long", from_entry="Buy", trail_price=close - atrValue * trailStopMultiplier, trail_offset=atrValue * stopLossMultiplier, limit=close + atrValue * takeProfitMultiplier)
if (strategy.position_size < 0)
strategy.exit("Trail Exit Short", from_entry="Sell", trail_price=close + atrValue * trailStopMultiplier, trail_offset=atrValue * stopLossMultiplier, limit=close - atrValue * takeProfitMultiplier)
// Pozisyon Kapatma Koşulları
if (ta.crossunder(close, QQES))
strategy.close("Buy") // Long pozisyonu kapat
if (ta.crossover(close, QQEF))
strategy.close("Sell") // Short pozisyonu kapat
// Ekstra Görselleştirme (Trend Renkleri)
longFillColor = QQEF > QQES ? color.new(color.green, 80) : na
shortFillColor = QQEF < QQES ? color.new(color.red, 80) : na
fill(plot1=plot(QQEF, display=display.none), plot2=plot(QQES, display=display.none), color=longFillColor, title="Uptrend Fill")
fill(plot1=plot(QQEF, display=display.none), plot2=plot(QQES, display=display.none), color=shortFillColor, title="Downtrend Fill")