// Calcular el Estocástico k = ta.sma(ta.stoch(close, high, low, stochLength), kSmoothing) d = ta.sma(k, dSmoothing)
// Condiciones de sobrecompra y sobreventa (Estocástico) isOverbought = k >= overbought and d >= overbought isOversold = k <= oversold and d <= oversold
// Identificar puntos de liquidez (soportes y resistencias) liquidityLookback = input.int(20, title="Liquidity Lookback Period") // Ajusta según la temporalidad recentHigh = ta.highest(high, liquidityLookback) recentLow = ta.lowest(low, liquidityLookback)
// Señales de compra y venta buySignal = isOversold and close <= recentLow * 1.005 // Cerca de soporte y Estocástico en sobreventa sellSignal = isOverbought and close >= recentHigh * 0.995 // Cerca de resistencia y Estocástico en sobrecompra
// Dibujar señales en el gráfico plotshape(series=buySignal, location=location.belowbar, color=color.new(color.green, 0), style=shape.labelup, text="BUY", size=size.small) plotshape(series=sellSignal, location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, text="SELL", size=size.small)
// Alertas para señales de compra y venta alertcondition(buySignal, title="Buy Signal Alert", message="Buy Signal Detected!") alertcondition(sellSignal, title="Sell Signal Alert", message="Sell Signal Detected!")