In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
study(title="Directional Movement Index - ADX Slope", shorttitle="ADX-SLOPE") len = input(14, title="DI Length", minval=1) lensig = input(14, title="ADX Smoothing", minval=1, maxval=50) lenslp = input(1, title="Slope Length", minval=1) up = change(high) down = -change(low) trur = rma(tr, len) plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur) minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur) sum = plus + minus adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig) slope = (adx - adx[lenslp])/lenslp hline(0, color=gray, title="Zero") plot(slope, color=black, title="ADX Slope", style=histogram)