
Die Strategie ist ein Trend-Tracking-System, basierend auf Multi-Index-Moving Averages (EMA). Es identifiziert Markttrends durch die Berechnung der Mittelwerte der kurz- und langfristigen EMA-Gruppen und erzeugt Handelssignale bei der Kreuzung von Gleichgewichten. Die Strategie integriert einen Stop-Loss-Mechanismus, um Risiken zu kontrollieren und Gewinne zu sperren.
Die Strategie verwendet sechs kurzfristige EMAs (Zyklen 3, 5, 8, 10, 12, 15) und sechs langfristige EMAs (Zyklen 30, 35, 40, 45, 50 und 60). Durch die Durchschnittsberechnung dieser Mittelwerte werden schlankere kurz- und langfristige Trendindikatoren erzeugt. Wenn die kurzfristige Mittellinie die langfristige Mittellinie aufwärts durchbricht, wird ein Mehr-Signal erzeugt; wenn die kurzfristige Mittellinie die langfristige Mittellinie nach unten durchbricht, wird ein Leer-Signal erzeugt.
Dies ist eine gut strukturierte Trend-Tracking-Strategie, die durch die Kombination von mehreren Mittellinien ein relativ zuverlässiges Handelssignal liefert. Obwohl ein gewisses Rückstandsrisiko besteht, kann die Gesamtperformance der Strategie durch eine vernünftige Stop-Loss-Einstellung und die empfohlene Optimierungsrichtung weiter verbessert werden.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-10 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Pavan Guppy Strategy", shorttitle="Pavan Avg", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Short-term EMAs
shortEMA1 = ta.ema(close, 3)
shortEMA2 = ta.ema(close, 5)
shortEMA3 = ta.ema(close, 8)
shortEMA4 = ta.ema(close, 10)
shortEMA5 = ta.ema(close, 12)
shortEMA6 = ta.ema(close, 15)
// Long-term EMAs
longEMA1 = ta.ema(close, 30)
longEMA2 = ta.ema(close, 35)
longEMA3 = ta.ema(close, 40)
longEMA4 = ta.ema(close, 45)
longEMA5 = ta.ema(close, 50)
longEMA6 = ta.ema(close, 60)
// Average short-term EMAs
shortAvg = (shortEMA1 + shortEMA2 + shortEMA3 + shortEMA4 + shortEMA5 + shortEMA6) / 6.0
// Average long-term EMAs
longAvg = (longEMA1 + longEMA2 + longEMA3 + longEMA4 + longEMA5 + longEMA6) / 6.0
// Plot averaged EMAs
plot(shortAvg, color=color.green, linewidth=2, title="Averaged Short-term EMAs")
plot(longAvg, color=color.red, linewidth=2, title="Averaged Long-term EMAs")
// Define the target and stop loss percentages
takeProfitPerc = 10
stopLossPerc = 5
// Generate buy signal when shortAvg crosses above longAvg
if ta.crossover(shortAvg, longAvg)
strategy.entry("Buy", strategy.long)
// Generate sell signal when shortAvg crosses below longAvg
if ta.crossunder(shortAvg, longAvg)
strategy.entry("Sell", strategy.short)
// Calculate take profit and stop loss prices for long trades
longTakeProfit = close * (1 + (takeProfitPerc / 100.0))
longStopLoss = close * (1 - (stopLossPerc / 100.0))
// Set take profit and stop loss for long positions
strategy.exit("Take Profit/Stop Loss", from_entry="Buy", limit=longTakeProfit, stop=longStopLoss)
// Calculate take profit and stop loss prices for short trades
shortTakeProfit = close * (1 - takeProfitPerc / 100.0)
shortStopLoss = close * (1 + stopLossPerc / 100.0)
// Set take profit and stop loss for short positions
strategy.exit("Take Profit/Stop Loss", from_entry="Sell", limit=shortTakeProfit, stop=shortStopLoss)