
Die Strategie ist ein auf mehreren technischen Indikatoren basierendes Trend-Tracking-Trading-System, das drei klassische technische Indikatoren kombiniert: den Moving Average (EMA), den Moving Average Convergence (MACD) und den Relativ Strong Indicator (RSI), um durch die Erfassung von Markttrendänderungen und -dynamik zu handeln. Die Strategie verwendet ein Parameter-Set wie schnelle EMA (Zyklus 9) und langsame EMA (Zyklus 21), MACD (Zyklus 12, 26, 9) und RSI (Zyklus 14), um ein Handelssignal zu senden, wenn der Indikator überschreitet und die Schwelle überschreitet.
Die Kernlogik der Strategie ist die Identifizierung von Wendepunkten in Markttrends durch die synchronisierte Bestätigung von mehreren technischen Indikatoren. Die Signalbestätigung umfasst die folgenden drei Aspekte:
Die Strategie erfasst die Veränderungen der Markttrends durch die Kreuzprüfung von mehreren technischen Indikatoren und weist eine bessere Zuverlässigkeit und Anpassungsfähigkeit auf. In der praktischen Anwendung ist jedoch auf Probleme wie Signalverzögerung und Überhandelung zu achten. Es wird empfohlen, die Stabilität und Profitabilität der Strategie durch die Einführung von Anpassungsparametern, Stop-Loss-Mechanismen und Marktumfelderkennung zu verbessern.
/*backtest
start: 2024-02-20 00:00:00
end: 2025-02-17 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA + MACD + RSI Strategy with Long and Short", overlay=true)
// Input parameters for MACD, EMA, and RSI
fast_ema_length = input.int(9, title="Fast EMA Length", minval=1)
slow_ema_length = input.int(21, title="Slow EMA Length", minval=1)
macd_short_length = input.int(12, title="MACD Short Length", minval=1)
macd_long_length = input.int(26, title="MACD Long Length", minval=1)
macd_signal_length = input.int(9, title="MACD Signal Length", minval=1)
rsi_length = input.int(14, title="RSI Length", minval=1)
rsi_oversold_level = input.int(30, title="RSI Oversold Level", minval=1)
rsi_overbought_level = input.int(70, title="RSI Overbought Level", minval=1)
// Calculate the MACD line and Signal line
[macdLine, signalLine, _] = ta.macd(close, macd_short_length, macd_long_length, macd_signal_length)
// Calculate the EMAs
fast_ema = ta.ema(close, fast_ema_length)
slow_ema = ta.ema(close, slow_ema_length)
// Calculate the RSI
rsi = ta.rsi(close, rsi_length)
// Conditions for long entry (bullish)
macd_bullish_crossover = ta.crossover(macdLine, signalLine) // MACD line crosses above Signal line
ema_bullish_crossover = ta.crossover(fast_ema, slow_ema) // Fast EMA crosses above Slow EMA
rsi_above_30 = rsi > rsi_oversold_level // RSI above 30 (not oversold)
long_condition = macd_bullish_crossover and ema_bullish_crossover and rsi_above_30
// Conditions for short entry (bearish)
macd_bearish_crossover = ta.crossunder(macdLine, signalLine) // MACD line crosses below Signal line
ema_bearish_crossover = ta.crossunder(fast_ema, slow_ema) // Fast EMA crosses below Slow EMA
rsi_below_70 = rsi < rsi_overbought_level // RSI below 70 (not overbought)
short_condition = macd_bearish_crossover and ema_bearish_crossover and rsi_below_70
// Execute long trade
if (long_condition)
strategy.entry("Long", strategy.long)
// Execute short trade
if (short_condition)
strategy.entry("Short", strategy.short)
// Plot the EMAs and MACD for visualization
plot(fast_ema, color=color.green, linewidth=2, title="Fast EMA")
plot(slow_ema, color=color.red, linewidth=2, title="Slow EMA")
plot(macdLine, color=color.blue, linewidth=2, title="MACD Line")
plot(signalLine, color=color.red, linewidth=2, title="Signal Line")
hline(30, "RSI 30", color=color.green)
hline(70, "RSI 70", color=color.red)
plot(rsi, color=color.purple, linewidth=2, title="RSI")