Skip to content

Commit

Permalink
fixing NaNs issue on KAMA
Browse files Browse the repository at this point in the history
  • Loading branch information
yarimiz committed Aug 18, 2022
1 parent 733f2d7 commit cc4e974
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ta/momentum.py
Expand Up @@ -321,7 +321,9 @@ def _run(self):
min_periods = 0 if self._fillna else self._window
er_num = abs(close_values - np.roll(close_values, self._window))
er_den = vol.rolling(self._window, min_periods=min_periods).sum()
efficiency_ratio = er_num / er_den
efficiency_ratio = np.divide(
er_num, er_den, out=np.zeros_like(er_num), where=er_den != 0
)

smoothing_constant = (
(
Expand Down

0 comments on commit cc4e974

Please sign in to comment.