indicator · own pane · open source
ADX Trend Filter
Running…
Loading chart…
About
DMI/ADX in one pane: ADX above the threshold means there is a trend worth following; +DI over −DI tells you its direction. Handy as a filter for other strategies.
Source code
//@version=5
indicator("ADX Trend Filter", overlay=false)
len = input.int(14, "DI length", minval=2)
smooth = input.int(14, "ADX smoothing", minval=1)
threshold = input.float(25, "Trend threshold")
[plus, minus, adx] = ta.dmi(len, smooth)
plot(adx, "ADX", color=color.orange, linewidth=2)
plot(plus, "+DI", color=color.green)
plot(minus, "-DI", color=color.red)
hline(threshold, "Threshold", color=color.gray)
bgcolor(adx > threshold ? (plus > minus ? color.new(color.green, 92) : color.new(color.red, 92)) : na)
alertcondition(ta.crossover(adx, threshold), "Trend starts", "ADX crossed above the threshold")
No comments yet.
Sign in to comment.