TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.7k stars 1.76k forks source link

The adx calculation formula is wrong. #576

Closed vnvdev closed 1 year ago

vnvdev commented 1 year ago

I use MT5 and Talib to calculate ADX, however, produce 2 completely different results!

mrjbq7 commented 1 year ago

Can you provide an example of the data and the two outputs, showing which one you think should be correct?On Jan 24, 2023, at 5:27 PM, Vũ Nhật Vượng @.***> wrote: I use MT5 and Talib to calculate ADX, however, produce 2 completely different results!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

vnvdev commented 1 year ago

https://github.com/vnvdev/adx-calculate-same-mt5/blob/main/adx.py Here is the code that compares my 2 outputs and the adx on talib. For talib, adx is only true on adx 14, the rest of the lengths are wrong

vnvdev commented 1 year ago

The reason I want to use talib is because it is faster than my code, but the results with adx7, adx21, adx other than 14 all give wrong results compared to mt5

vnvdev commented 1 year ago

As for my code all adx are correct with mt5

vnvdev commented 1 year ago

Hope you fix it soon

trufanov-nok commented 1 year ago

Have you tried talib.set_compatibility(1) before ADX call?

vnvdev commented 1 year ago

Have you tried talib.set_compatibility(1) before ADX call?

What is this?

trufanov-nok commented 1 year ago

https://stackoverflow.com/questions/74896623/python-ema-calculation-using-talib-and-pandas-ewn-different-from-tradingview

Have you tried talib.set_compatibility(1) before ADX call?

What is this?

vnvdev commented 1 year ago

https://stackoverflow.com/questions/74896623/python-ema-calculation-using-talib-and-pandas-ewn-different-from-tradingview

Have you tried talib.set_compatibility(1) before ADX call?

What is this?

This not work with adx

vnvdev commented 1 year ago

Im fixed it with my Cython code, it very fast same talib. Here is my code https://github.com/vnvdev/adx_faster

pablobrunetti commented 1 year ago

@vnvdev, is this code work with Plus Directional Indicator(PLUS_DI ) and Minus Directional Indicator(MINUS_DI)? I had the same problem.

vnvdev commented 1 year ago

The code only calculates the adx index, the other indicators do not