OPEN-SOURCE SCRIPT

EMA Crossover with VWAP and SMA

101
//version=5
// Indicator: EMA Crossover with VWAP and SMA 200
indicator("EMA Crossover with VWAP and SMA", overlay=true)

// Definir las EMAs
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)

// Definir VWAP y SMA 200
vwap_line = ta.vwap(hlc3)
sma200 = ta.sma(close, 200)

// Detectar cruces
crossOver = ta.crossover(ema21, ema50)
crossUnder = ta.crossunder(ema21, ema50)

// Plotear las líneas
plot(ema21, color=color.blue, title="EMA 21", linewidth=2)
plot(ema50, color=color.red, title="EMA 50", linewidth=2)
plot(vwap_line, color=color.purple, title="VWAP", linewidth=1)
plot(sma200, color=color.orange, title="SMA 200", linewidth=2)

// Señales de compra y venta
plotshape(crossOver, title="Compra", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(crossUnder, title="Venta", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)

// Alertas
alertcondition(crossOver, title="Señal de Compra", message="EMA 21 cruza por encima de EMA 50 - Posible Compra")
alertcondition(crossUnder, title="Señal de Venta", message="EMA 21 cruza por debajo de EMA 50 - Posible Venta")

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。