//version=5
indicator(“Options Buy Signals (Calls & Puts)”, overlay=true)

// === INPUTS ===
rsiSource = close
rsiLength = input.int(14, title=”RSI Length”)
rsiOverbought = input.int(70, title=”Overbought Level”)
rsiOversold = input.int(30, title=”Oversold Level”)
smaLength = input.int(20, title=”SMA Length”)

// === CALCULATIONS ===
rsi = ta.rsi(rsiSource, rsiLength)
sma = ta.sma(close, smaLength)

// === SIGNAL CONDITIONS ===
buyCall = ta.crossover(rsi, rsiOversold) and close > sma
buyPut = ta.crossunder(rsi, rsiOverbought) and close < sma

// === PLOT SIGNALS ===
plotshape(buyCall, title=”Buy Call Signal”, location=location.belowbar, color=color.green, style=shape.labelup, text=”CALL”)
plotshape(buyPut, title=”Buy Put Signal”, location=location.abovebar, color=color.red, style=shape.labeldown, text=”PUT”)

// === ALERT CONDITIONS ===
alertcondition(buyCall, title=”Buy Call Alert”, message=”Potential Buy Call Opportunity”)
alertcondition(buyPut, title=”Buy Put Alert”, message=”Potential Buy Put Opportunity”)

Shares: