RSI TREND FILTER
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderharikrishna
// Idea and Code by @traderharikrishna
//@version=5
indicator("RSI TREND FILTER",overlay=true)
showrsi=input.bool(false,title='Show RSI Cloud',group='RSI ')
showmidband=input.bool(false,title='Show RSI Mid Band',group='RSI ')
showgrid=input.bool(false,title='Show RSI Levels',group='RSI Levels')
grid=input.color(color.rgb(26, 22, 22, 34),'RSI LEVELS',group='RSI Levels')
rsilen=input.int(14,'RSI LENGTH',group='RSI')
rsima=input.int(100,'RSI 50 level',group='RSI')
emalen=input.int(20,'RSI EMA Length',group='RSI')
orsi=ta.rsi(close,rsilen)
adjrsi=close+ta.atr(100)*orsi/100
rma=ta.ema(adjrsi,rsima)
r1=plot(showrsi?adjrsi:na,display=display.all,title='RSI')
r2=plot(rma,color=open>rma?#00ff08:open<rma?#ff0404:color.white,title='RSI MA',linewidth=2)
fill(r1,r2,color=adjrsi>rma?color.rgb(76, 175, 79, 70):color.rgb(255, 82, 82, 75),title='RSI Cloud',display=showrsi?display.all:display.none)
level2=input.float(10,'RSI LEVEL2',minval=10,maxval=100,group='RSI Levels')
rmau=rma+ta.atr(100)*level2/10
rmal=rma-ta.atr(100)*level2/10
u=plot(rmau,display=showgrid?display.all:display.none,title='70',color=grid)
l=plot(rmal,display=showgrid?display.all:display.none,title='30',color=grid)
fill(u,l,color=color.rgb(232, 237, 242, 82),title='RSI ZeroBand',display=showmidband?display.all:display.none)
level3=input.float(40,'RSI LEVEL3',minval=10,maxval=100,group='RSI Levels')
rmau3=rma+ta.atr(100)*level3/10
rmal3=rma-ta.atr(100)*level3/10
o8=plot(rmau3,display=showgrid?display.all:display.none,title='80',color=grid)
o2=plot(rmal3,display=showgrid?display.all:display.none,title='20',color=grid)
level5=input.float(50,'RSI LEVEL5',minval=10,maxval=100,group='RSI Levels')
rmau5=rma+ta.atr(100)*level5/10
rmal5=rma-ta.atr(100)*level5/10
ul=plot(rmau5,color=grid,display=showgrid?display.all:display.none,title='100')
ll=plot(rmal5,color=grid,display=showgrid?display.all:display.none,title='0')
fill(o8,ul,color=color.rgb(232, 4, 205, 45),title='OverBought')
fill(o2,ll,color=color.rgb(9, 198, 15, 53),title='OverSold')
fill(r2,ul,color=color.rgb(76, 175, 79, 85),title='UP TREND')
fill(r2,ll,color=color.rgb(175, 76, 167, 85),title='DOWN TREND')

rsiMA=ta.ema(adjrsi,emalen)
plot(rsiMA,color=color.yellow)