//@version=4 strategy("Scalping Strategy Ashitrades", overlay=true) // Parámetros de configuración stopLossPoints = input(5, title="Stop Loss Points") takeProfitPoints = input(100, title="Take Profit Points") length = input(20, title="Keltner Length") mult = input(1, title="Keltner Multiplier") rsiLength = input(14, title="RSI Length") rsiOverbought = input(70, title="RSI Overbought Level") rsiOversold = input(30, title="RSI Oversold Level") // Calcular el VWAP vwapValue = vwap(close) // Calcular las Bandas de Keltner basis = sma(close, length) upperKeltner = basis + mult * stdev(close, length) lowerKeltner = basis - mult * stdev(close, length) // Calcular el RSI rsiValue = rsi(close, rsiLength) // Filtro de señales de entrada para compra buyFilterCondition = close > upperKeltner // Solo tomar señales cuando el precio está por encima de la banda superior de Keltner buyFilterCondition := buyFilterCondition and rsiValue < rsiOverbought // Evitar señales de entrada cuando el RSI está en niveles de sobrecompra // Filtro de señales de entrada para venta sellFilterCondition = close < lowerKeltner // Solo tomar señales cuando el precio está por debajo de la banda inferior de Keltner sellFilterCondition := sellFilterCondition and rsiValue > rsiOversold // Evitar señales de entrada cuando el RSI está en niveles de sobreventa // Definir el stop loss y la toma de ganancias en puntos fijos longStopLoss = stopLossPoints * syminfo.mintick longTakeProfit = takeProfitPoints * syminfo.mintick shortStopLoss = stopLossPoints * syminfo.mintick shortTakeProfit = takeProfitPoints * syminfo.mintick // Condiciones de entrada (compra) buyCondition = close > vwapValue and buyFilterCondition if (buyCondition) strategy.entry("Buy", strategy.long) strategy.exit("Take Profit/Stop Loss", "Buy", stop=close - longStopLoss, limit=close + longTakeProfit) // Condiciones de entrada (venta) sellCondition = close < vwapValue and sellFilterCondition if (sellCondition) strategy.entry("Sell", strategy.short) strategy.exit("Take Profit/Stop Loss", "Sell", stop=close + shortStopLoss, limit=close - shortTakeProfit) // Graficar el VWAP, las Bandas de Keltner y el RSI plot(vwapValue, color=color.blue, title="VWAP") plot(upperKeltner, color=color.green, title="Upper Keltner") plot(lowerKeltner, color=color.red, title="Lower Keltner")