
Die Strategie ist ein integriertes Handelssystem, das eine Kombination aus Multiple-Index-Moving Averages (EMA) -Kreuzungen, realen Volatilitätsbreiten (ATR) und Pivot-Support-Resistenzen (Pivot Points) kombiniert. Die Strategie erfasst die Trendwendepunkte in den Märkten in Kombination mit ATR-Schwankungen und wichtigen Preisniveaus durch die Kreuzung von kurzfristigen EMAs mit mittleren und langfristigen EMAs.
Die Strategie basiert auf einer technischen Analyse in drei Dimensionen:
Die Regeln für den Handel sind klar:
Die Strategie basiert auf der Synergie von mehreren technischen Indikatoren, um ein relativ vollständiges Handelssystem zu schaffen. Die Kernvorteile der Strategie liegen in der mehrdimensionalen Signalbestätigung und dem ausgefeilten Risikokontrollsystem, aber die Optimierung der Parameter und die Verbesserung der Systeme durch die Händler im Hinblick auf die spezifischen Marktbedingungen sind noch erforderlich. Durch die empfohlene Optimierungsrichtung wird die Stabilität und Zuverlässigkeit der Strategie voraussichtlich weiter verbessert.
/*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("EMA Crossover + ATR + PPSignal", overlay=true)
//--------------------------------------------------------------------
// 1. Cálculo de EMAs y ATR
//--------------------------------------------------------------------
ema4 = ta.ema(close, 4)
ema9 = ta.ema(close, 9)
ema18 = ta.ema(close, 18)
atrLength = 14
atr = ta.atr(atrLength)
//--------------------------------------------------------------------
// 2. Cálculo de Pivot Points diarios (PPSignal)
// Tomamos datos del día anterior (timeframe D) para calcularlos
//--------------------------------------------------------------------
dayHigh = request.security(syminfo.tickerid, "D", high[1])
dayLow = request.security(syminfo.tickerid, "D", low[1])
dayClose = request.security(syminfo.tickerid, "D", close[1])
// Fórmula Pivot Points estándar
pp = (dayHigh + dayLow + dayClose) / 3.0
r1 = 2.0 * pp - dayLow
s1 = 2.0 * pp - dayHigh
r2 = pp + (r1 - s1)
s2 = pp - (r1 - s1)
r3 = dayHigh + 2.0 * (pp - dayLow)
s3 = dayLow - 2.0 * (dayHigh - pp)
//--------------------------------------------------------------------
// 3. Definir colores para las EMAs
//--------------------------------------------------------------------
col4 = color.green // EMA 4
col9 = color.yellow // EMA 9
col18 = color.red // EMA 18
//--------------------------------------------------------------------
// 4. Dibujar indicadores en el gráfico
//--------------------------------------------------------------------
// EMAs
plot(ema4, title="EMA 4", color=col4, linewidth=2)
plot(ema9, title="EMA 9", color=col9, linewidth=2)
plot(ema18, title="EMA 18", color=col18, linewidth=2)
// ATR
plot(atr, title="ATR", color=color.blue, linewidth=2)
// Pivot Points (PPSignal)
plot(pp, title="Pivot (PP)", color=color.new(color.white, 0), style=plot.style_line, linewidth=1)
plot(r1, title="R1", color=color.new(color.red, 0), style=plot.style_line, linewidth=1)
plot(r2, title="R2", color=color.new(color.red, 0), style=plot.style_line, linewidth=1)
plot(r3, title="R3", color=color.new(color.red, 0), style=plot.style_line, linewidth=1)
plot(s1, title="S1", color=color.new(color.green, 0), style=plot.style_line, linewidth=1)
plot(s2, title="S2", color=color.new(color.green, 0), style=plot.style_line, linewidth=1)
plot(s3, title="S3", color=color.new(color.green, 0), style=plot.style_line, linewidth=1)
//--------------------------------------------------------------------
// 5. Condiciones de cruce (EMA4 vs EMA9 y EMA18) y estrategia
//--------------------------------------------------------------------
crossedAbove = ta.crossover(ema4, ema9) and ta.crossover(ema4, ema18)
crossedBelow = ta.crossunder(ema4, ema9) and ta.crossunder(ema4, ema18)
// Señales de Buy y Sell basadas en cruces + condición con ATR
if crossedAbove and close > ema9 + atr
strategy.entry("Buy", strategy.long)
strategy.exit("Sell", "Buy", stop=ema4)
if crossedBelow and close < ema9 - atr
strategy.entry("Sell", strategy.short)
strategy.exit("Cover", "Sell", stop=ema4)