Bollinger Band Alert with RSI Filter Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © dwdventer

//@version=5
indicator('Bollinger Band Alert with RSI Filter',  shorttitle="BBRSI+ALERT INDICATOR", overlay=true)

// Inputs
length = input(title='BB Length', defval=20)
mult = input.float(title='BB Multiplier', defval=2, step=0.1)
upper_rsi = input(title='Upper RSI', defval=75)
lower_rsi = input(title='Lower RSI', defval=25)
rsi_length = input(title='RSI Length', defval=14)

// Bollinger Bands
bb_avg = ta.sma(close, length)
bb_upper = bb_avg + mult * ta.stdev(close, length)
bb_lower = bb_avg - mult * ta.stdev(close, length)

// RSI
rsi = ta.rsi(close, rsi_length)


// Plotting
plot(bb_upper, color=color.new(color.red, 0), linewidth=1)
plot(bb_lower, color=color.new(color.red, 0), linewidth=1)
plot(bb_avg, color=color.new(color.blue, 0), linewidth=1)


// Long and Short Entry Overlays
long_entry = close < bb_lower
short_entry = close > bb_upper

plotshape(long_entry and rsi < lower_rsi, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.small, title='Long Entry')
plotshape(short_entry and rsi > upper_rsi, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.small, title='Short Entry')

// Alert conditions for long and short entries
alertcondition(long_entry and rsi < lower_rsi, title='Long Entry', message='Long Entry Alert')
alertcondition(short_entry and rsi > upper_rsi, title='Short Entry', message='Short Entry Alert')