From a6c3cc907726aa2a4f5372bc4e97d6b711f06fc7 Mon Sep 17 00:00:00 2001 From: Vlad86 <84722428+WaldemarGrauberger@users.noreply.github.com> Date: Sun, 19 Dec 2021 10:09:04 +0100 Subject: [PATCH] Adjusted starting indices for adx_pos and adx_neg Changed the starting index in rows 799 and 814 from 1 to 0. Otherwise, when printing the final adx together with adx_neg and adx_pos, it looked like the adx was computed based on one row too little. Computation was correct, just looked wrong. --- ta/trend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ta/trend.py b/ta/trend.py index edba1440..a446e525 100644 --- a/ta/trend.py +++ b/ta/trend.py @@ -796,7 +796,7 @@ def adx_pos(self) -> pd.Series: pandas.Series: New feature generated. """ dip = np.zeros(len(self._close)) - for i in range(1, len(self._trs) - 1): + for i in range(0, len(self._trs) - 1): dip[i + self._window] = 100 * (self._dip[i] / self._trs[i]) adx_pos_series = self._check_fillna( @@ -811,7 +811,7 @@ def adx_neg(self) -> pd.Series: pandas.Series: New feature generated. """ din = np.zeros(len(self._close)) - for i in range(1, len(self._trs) - 1): + for i in range(0, len(self._trs) - 1): din[i + self._window] = 100 * (self._din[i] / self._trs[i]) adx_neg_series = self._check_fillna(