ADX trend reversal/continuation spotter
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bonny99

//@version=5
indicator("ADX trend reversal/continuation spotter" , overlay = false)

[dp , dm , adx] = ta.dmi(14,14)
decrement = input.int(60 , "decrement/increment value")
lookback = input.int(20, "lookback")
pivotHAdx = ta.pivothigh(adx , lookback , 0)
adxDec = (pivotHAdx - ((pivotHAdx/100)*decrement))
pivotLAdx = ta.pivotlow(adx , lookback , 0)
adxIncL = (pivotLAdx + ((pivotLAdx/100)*decrement))

plot(adx, "adx" , color.rgb(0, 30, 255) , 2)
plot(pivotHAdx , "pivot high" , color.rgb(0, 255, 8) , 1)
plot(adxDec , "decreased adx" , color.blue , 1 , display = display.none)
plot(pivotLAdx , "pivot low" , color.rgb(255, 0, 0) , 1)
plot(adxIncL , "increased adx" , color.blue , 1, display = display.none)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//indicator 2
lengthAvgAdx= input.int(50,"sma adx" , 3 , 999)
adxAvg = ta.sma(adx , lengthAvgAdx)
plot(adxAvg , "adx avg" , color.white , 1 , plot.style_line, display = display.none)
hline(40 , "line 40" , color.white , hline.style_dotted , 1 , editable = true )
hline(15 , "line 15" , color.white , hline.style_dotted , 1 , editable = true )
