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

ADX slow, can be vectorized #286

Open
jaymegordo opened this issue Mar 10, 2022 · 1 comment
Open

ADX slow, can be vectorized #286

jaymegordo opened this issue Mar 10, 2022 · 1 comment

Comments

@jaymegordo
Copy link

I notice the ADX indicator is very slow (~1s to calculate for a df with ~200k rows), and I'm noticing the implementation uses several for loops.

I'm not exactly sure how the ADX calculation works, but in pandas_ta for example, they have a vectorized implementation which is ~10x faster. Included the TA-Lib c implementation just for comparison:
Screen Shot 2022-03-10 at 11 58 31 AM

Seems like it would be easy to just copy their implementation and give attribution?

@Groni3000
Copy link
Contributor

Groni3000 commented Nov 4, 2023

@jaymegordo Don't know talib implementation, but about pandas_ta... They use different smoothing method: it is the exponentially weighted moving average with alpha = 1 / window, adjusted version.

ta atr using another smoothing method, that cannot be vectorized, though it can be faster (~6.5 times), it requires little changes. You can find better explanation here: #326

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

No branches or pull requests

3 participants