OPEN-SOURCE SCRIPT

SUPER TREND + RSI FILTER PRO

78
version=5
indicator("SUPER TREND + RSI FILTER PRO", overlay=true, timeframe="", timeframe_gaps=true)

//---------------------------
// INPUTS
//---------------------------
factor = input.float(3.0, "SuperTrend Factor")
atr_len = input.int(10, "ATR Length")
rsi_len = input.int(14, "RSI Length")
rsi_buy = input.int(50, "RSI Buy Level")
rsi_sell = input.int(50, "RSI Sell Level")

//---------------------------
// SUPERTREND CALCULATION
//---------------------------
atr = ta.atr(atr_len)
upperBand = close + factor * atr
lowerBand = close - factor * atr

trend = 0.0
trend := close > nz(trend[1]) ? math.max(lowerBand, nz(trend[1])) : math.min(upperBand, nz(trend[1]))

// Coloration
bull = close > trend
bear = close < trend

//---------------------------
// RSI FILTER
//---------------------------
rsi = ta.rsi(close, rsi_len)

//---------------------------
// BUY & SELL SIGNALS
//---------------------------
buySignal = bull and rsi > rsi_buy and close > trend
sellSignal = bear and rsi < rsi_sell and close < trend

//---------------------------
// PLOT SUPERTREND
//---------------------------
plot(trend, color=bull ? color.green : color.red, linewidth=2, title="SuperTrend")

//---------------------------
// BUY / SELL MARKERS
//---------------------------
plotshape(buySignal, title="Buy", style=shape.labelup, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="Sell", style=shape.labeldown, color=color.red, size=size.small, text="SELL")

//---------------------------
// ALERTS
//---------------------------
alertcondition(buySignal, title="Buy Signal", message="BUY Signal - SuperTrend + RSI Filter")
alertcondition(sellSignal, title="Sell Signal", message="SELL Signal - SuperTrend + RSI Filter")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.