//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[1] < oversold) and (rsiValue > oversold)

// Divergencias bajistas (Bearish Divergence)
bearishDivergence = (rsiValue[1] > 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")
Technical Indicators

Exención de responsabilidad