Best indicator
2024-09-26

//@version=5
indicator("Best Entry Indicator", overlay = true)

// MACD settings
  = ta.macd(close, 12, 26, 9)
macdSignal = macdLine - signalLine

// RSI settings
rsiValue = ta.rsi(close, 14)

// Entry rules
longEntry = ta.crossover(macdLine, signalLine) and rsiValue < 30
shortEntry = ta.crossunder(macdLine, signalLine) and rsiValue > 70

// Plot arrows for entry points
plotshape(series = longEntry, title = "Long Entry", location = location.belowbar, color = color.green, style=shape.labelup, text="BUY")
plotshape(series = shortEntry, title = "Short Entry", location = location.abovebar, color = color.red, style=shape.labeldown, text="SELL")

// Display MACD and RSI
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
hline(30, "Oversold", color=color.green)
hline(70, "Overbought", color=color.red)
plot(rsiValue, color=color.purple, title="RSI")
