Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is ADX correct (difference with TradingView) #244

Open
enriquepiatti opened this issue Aug 28, 2021 · 2 comments
Open

is ADX correct (difference with TradingView) #244

enriquepiatti opened this issue Aug 28, 2021 · 2 comments

Comments

@enriquepiatti
Copy link

enriquepiatti commented Aug 28, 2021

I'm comparing the results from TradingView charts (with ADX built in indicator), same input period, same candles (this is ok because the SMA for example is returning same values in TradingView and with technicalindicators), but the result for ADX is not the same!
Does somebody know why is that?
Do you know some other chart with ADX indicator to compare with a 3rd reference?

This is the code used by TradingView (in PineScript):

up = change(high)
down = -change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
truerange = rma(tr, len)
plus = fixnan(100 * rma(plusDM, len) / truerange)
minus = fixnan(100 * rma(minusDM, len) / truerange)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

rma = Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.

@marcusmota
Copy link

see my comment here #239, might work for you as well

@jere-0
Copy link

jere-0 commented Sep 12, 2021

I used the following page to develop my custom ADX indicator: https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx

Also, you can pull up a chart with the ADX indicator for free on any stock. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants