SMOOTHED RSI SWITCH
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TShong99

// © ThembShong99

//@version=5
indicator('SMOOTHED RSI SWITCH')

Sensitivity = input(14)
Smoothness = input(25)

osc = ta.rsi(close, Sensitivity)
smoothOsc = ta.hma(osc, Smoothness)

oscPlot = plot(smoothOsc)
fairLine = hline(50, title='fair', linestyle=hline.style_solid, editable=false, color=color.gray)
cheapPrice = hline(30, title='cheap', linestyle=hline.style_solid, editable=false, color=color.lime)
expensivePrice = hline(70, title='expensive', linestyle=hline.style_solid, editable=false, color=color.red)
fairLinePlot = plot(50, color=na, editable=false)
cheapLinePlot = plot(30, color=na, editable=false)
expensLinePlot = plot(70, color=na, editable=false)

fill(oscPlot, fairLinePlot, color=smoothOsc > 50 and smoothOsc > smoothOsc[1] ? color.new(color.lime, 50): na)
fill(oscPlot, fairLinePlot, color=smoothOsc < 50 and smoothOsc < smoothOsc[1] ? color.new(color.red, 50) : na)

fill(oscPlot, expensLinePlot, color=smoothOsc > 70 and smoothOsc > smoothOsc[1] ? color.new(color.lime, 50) : na)
fill(oscPlot, expensLinePlot, color=smoothOsc > 70 and smoothOsc < smoothOsc[1] ? color.new(color.lime, 70) : na)

fill(oscPlot, cheapLinePlot, color=smoothOsc < 30 and smoothOsc < smoothOsc[1] ? color.new(color.red, 50) : na)
fill(oscPlot, cheapLinePlot, color=smoothOsc < 30 and smoothOsc > smoothOsc[1] ? color.new(color.red, 70) : na)
