RDX Relative Directional Index
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderharikrishna
// Send me Coins : https://www.tradingview.com/gopro/?share_your_love=traderharikrishna
//@version=5
indicator("RDX")
rsi=ta.rsi(close,14)
[p,m,a]=ta.dmi(14,14)
r=plot(rsi,color=color.rgb(85, 85, 85),linewidth=1)
s1=plot(a>20?na:45,color=color.rgb(100, 100, 100),style=plot.style_linebr)
s2=plot(a>20?na:55,color=color.rgb(100, 100, 100),style=plot.style_linebr)
fill(s1,s2,color=a>20?na:color.rgb(162, 162, 163, 70))
hline(50,color=color.rgb(100, 100, 100),linestyle=hline.style_solid)
hline(20,color=color.rgb(100, 100, 100),linestyle=hline.style_dotted)
hline(80,color=color.rgb(100, 100, 100),linestyle=hline.style_dotted)
str=a>20?(a-20)/5:0
d=plot( str+rsi,display=display.none)
fill(d,r,color=p>m?color.rgb(4, 250, 13):color.rgb(253, 5, 5))
buy=ta.crossover(p,m)
sell=ta.crossunder(p,m)  
plotshape(buy?rsi:na,text='', textcolor=color.white,size=size.tiny, title='ADX Buy',location = location.absolute,color=color.green,style = shape.triangleup)
plotshape(sell?rsi:na,text='', textcolor=color.white,size=size.tiny,  title='ADX Sell',location = location.absolute,color=color.red,style = shape.triangledown)
alertcondition(buy,title='ADX Buy Alert',message='ADX Buy Alert')
alertcondition(sell,title='ADX Sell Alert',message='ADX Sell Alert')