FOREXCOM:XAUUSD   Oro al contado/Dólar estadounidense
//@version=4
study(title="Estrategia RSI y Divergencias", shorttitle="RSI-Div", overlay=true)

// Parámetros de entrada
length = input(14, title="RSI Length")
overbought = input(70, title="Overbought Level")
oversold = input(30, title="Oversold Level")

// RSI
rsiValue = rsi(length)

// Divergencias alcistas (Bullish Divergence)
bullishDivergence = (rsiValue < oversold) and (rsiValue > oversold)

// Divergencias bajistas (Bearish Divergence)
bearishDivergence = (rsiValue > overbought) and (rsiValue < overbought)

// Condiciones de compra y venta
longCondition = bullishDivergence
shortCondition = bearishDivergence

// Colores para las flechas en el gráfico
plotshape(series=longCondition, location=location.belowbar, color=color.green, style=shape.triangleup, title="Compra")
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.triangledown, title="Venta")
Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.