Prueba 1 ia botPrueba:
//@version=5
strategy("Trading Strategy with Bollinger Bands, MACD, KST, and EMA Rotation", overlay=true)
// Bollinger Bands
length = input(20, minval=1, title="BB Length")
mult = input(2.0, minval=0.1, title="BB Mult")
source = close
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
// MACD
= macd(close, 12, 26, 9)
// KST
kst = kst(close)
// EMA Rotation
ema3 = ema(close, 3)
ema9 = ema(close, 9)
ema20 = ema(close, 20)
ema50 = ema(close, 50)
ema200 = ema(close, 200)
// Positive and Negative Rotation
positiveRotation = ema3 > ema9 and ema9 > ema20 and ema20 > ema50 and ema50 > ema200
negativeRotation = ema3 < ema9 and ema9 < ema20 and ema20 < ema50 and ema50 < ema200
// Entry Conditions
enterLong = crossover(macdLine, signalLine) and close > upper and kst > 0 and positiveRotation
enterShort = crossunder(macdLine, signalLine) and close < lower and kst < 0 and negativeRotation
// Exit Conditions
exitLong = crossunder(macdLine, signalLine) or close < lower
exitShort = crossover(macdLine, signalLine) or close > upper
// Strategy Execution
strategy.entry("Long", strategy.long, when=enterLong)
strategy.entry("Short", strategy.short, when=enterShort)
strategy.close("Long", when=exitLong)
strategy.close("Short", when=exitShort)
// Plotting
plot(upper, color=color.blue)
plot(lower, color=color.blue)
plot(macdLine, color=color.orange)
plot(signalLine, color=color.red)
plot(kst, color=color.green)