StableF-Adx
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © E-Nifty
// it is just adx with extra drawline and plotshape of crossover 

//@version=5
indicator(title="stableF-Adx",  format=format.price, precision=4)
lensig = input.int(7, title="ADX Smoothing", minval=1, maxval=50)
len = input.int(14, minval=1, title="DI Length")
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)

//l1=label.new(x=bar_index, y=adx>=25?adx:na, yloc=yloc.price,color=color.green,text="Strong Trend")
plotshape(adx>=25?adx:na,text="Strong Trend",show_last=1,location=location.absolute,textcolor=color.black,offset=4,color=color.green,style=shape.labeldown,size=size.large)
plotshape(adx<25?adx:na,text="Weak Trend",show_last=1,location=location.absolute,textcolor=color.black,offset=4,color=color.red,style=shape.labelup,size=size.large)

plot(plus, color=#2962FF, title="+DI")
plot(minus, color=#FF6D00, title="-DI")
plotshape(ta.crossover(plus,minus)?plus:na,color=color.green,text="Up",location=location.absolute)
plotshape(ta.crossunder(plus,minus)?minus:na,color=color.red,text="Dn",location=location.absolute)
hline(25,color=#050505,linewidth=2,linestyle=hline.style_solid)
