//@version=5
indicator("Order Block Scalping Indicator", shorttitle="OB-Scalp", overlay=true)
// Inputs
ema_length = input.int(50, title="EMA Length")
rsi_length = input.int(14, title="RSI Length")
rsi_overbought = input.int(70, title="RSI Overbought Level")
rsi_oversold = input.int(30, title="RSI Oversold Level")
// EMA
ema = ta.ema(close, ema_length)
plot(ema, title="EMA", color=color.blue, linewidth=2)
// RSI
rsi = ta.rsi(close, rsi_length)
// Order Block Detection
var float ob_high = na
var float ob_low = na
if (ta.crossover(close, ema))
ob_high := high
ob_low := low
if (ta.crossunder(close, ema))
ob_high := na
ob_low := na
// Buy and Sell Signals
buy_signal = ta.crossover(close, ema) and rsi < rsi_oversold and close > ob_high
sell_signal = ta.crossunder(close, ema) and rsi > rsi_overbought and close < ob_low
plotshape(series=buy_signal, location=location.belowbar, color=color.green,
style=shape.labelup, text="BUY", size=size.small, textcolor=color.white)
plotshape(series=sell_signal, location=location.abovebar, color=color.red,
style=shape.labeldown, text="SELL", size=size.small, textcolor=color.white)
// Plot Order Block Levels
plot(ob_high, title="Order Block High", color=color.green, linewidth=1,
style=plot.style_linebr)
plot(ob_low, title="Order Block Low", color=color.red, linewidth=1,
style=plot.style_linebr)