ADX and DI

Average Directional Index ( ADX )
See for detail.
Remove from Favorite Scripts Add to Favorite Scripts
study("ADX and DI")
len = input(title="Length", type=integer, defval=14)
th = input(title="threshold", type=integer, defval=20)

TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0

SmoothedTrueRange = nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange
SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus

DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
ADX = sma(DX, len)

plot(DIPlus, color=green, title="DI+")
plot(DIMinus, color=red, title="DI-")
plot(ADX, color=black, title="ADX")
hline(th, color=black, linestyle=dashed)
Hi , Nice indicator! Could you please tell me what other indicators you prefer with this for intraday trading. Thanks.
+12 Reply
Это самый хороший инструмент, из всех которые здесь есть. Люди хватайте его и пользуйтесь, 90% сигналов на бинарах отрабатывают в + на часовом графике, входим на 2 свечи по сигналу. Всем удачной торговли ! )))
+7 Reply
igor131 Nikolai77
@Nikolai77, Еще бы разобраться, как им пользоваться....(
+1 Reply
Will you please tell me which packages are required for the functions study(), input()?
Thanking you in anticipation
+5 Reply
How to build exponential ADX?
Hi, is it possible to test the performance with trading view strategy tester? Would be very interesting. Thanks for your help!
+2 Reply
Hi, good one. Thank You. Can you guide how can we scan the stocks using this whenever +DI / -DI crosses some levels ? Thanks in advance.
Nicely done,thanks for this.
Was surprised ADX was not included as one of the 'Built-in' indicators. To add to this, would it be possible to include additional threshold levels in-line with the ADX article .
+5 Reply
it is, its part of the directional movement indicator which kindas throws me off because this is exactly the same as the built in one?
MasaNakamura liftedAnalytics.Lmt
Yes, ADX and DI were built in TradingView but I overlooked them that's why I wrote this script :)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out