Bitcoin / TetherUS Binance
Descripción ⋅ 31 de Ene. de 2024 6:54 //@version =5 strategy("Estrategia Completa", overlay=true) // Definir medias móviles fastLength = input(9, title="Fast MA Length") slowLength = input(21, title="Slow MA Length") fastMA = sma(close, fastLength) slowMA = sma(close, slowLength) // Definir RSI rsiLength = input(14, title="RSI Length") rsiLevel = input(70, title="RSI Overbought Level") rsiCondition = rsi(close, rsiLength) > rsiLevel // Definir MACD [macdLine, signalLine, _] = macd(close, 12, 26, 9) macdCondition = crossover(macdLine, signalLine) // Definir volumen volCondition = volume > sma(volume, 20) // Condiciones de entrada y salida longCondition = crossover(fastMA, slowMA) and rsiCondition and macdCondition and volCondition shortCondition = crossunder(fastMA, slowMA) and rsiCondition and macdCondition and volCondition // Ejecutar estrategia strategy.entry("Long", strategy.long, when=longCondition) strategy.entry("Short", strategy.short, when=shortCondition) strategy.close("Long", when=shortCondition) strategy.close("Short", when=longCondition) // Plotear medias móviles plot(fastMA, color=color.blue, title="Fast MA") plot(slowMA, color=color.red, title="Slow MA") // Plotear RSI hline(rsiLevel, "RSI Overbought", color=color.red) // Plotear MACD plot(macdLine - signalLine, color=color.green, title="MACD Histogram") // Plotear volumen plot(volume, color=color.purple, title="Volume")