bukosabino / ta

Technical Analysis Library using Pandas and Numpy
https://technical-analysis-library-in-python.readthedocs.io/en/latest/
MIT License
4.25k stars 867 forks source link

Added 0-in-denominator checks in trend.ADXIndicator #319

Closed reesh19 closed 10 months ago

reesh19 commented 1 year ago

I was getting this "invalid value encountered in scalar divide" warning with any input data I used. I searched for a fix but no amount of data-transformations worked, then I saw many users reporting the same issue in the exact same line dip[idx] = 100 * (self._dip[idx] / value), so I wrote a simple fix for it. In short, I added checks to make sure we never divide by 0.

bukosabino commented 10 months ago

Thank you @reesh19

The changes will be included in the next version of the library!