diff --git a/src/pages/backtesting/backtesting_page.py b/src/pages/backtesting/backtesting_page.py index f29f2bd..65d31e7 100644 --- a/src/pages/backtesting/backtesting_page.py +++ b/src/pages/backtesting/backtesting_page.py @@ -145,8 +145,17 @@ class DynamicStrategy(Strategy): elif ind_config['type'] == 'ADX': def adx_calc(high, low, close): - result = ta.adx(high, low, close, length=int(ind_config['params']['length'])) - return result.fillna(method='ffill').fillna(0).values + result = ta.adx(high=pd.Series(high), + low=pd.Series(low), + close=pd.Series(close), + length=int(ind_config['params']['length']), + lensig=14) # Adding lensig parameter + if isinstance(result, pd.DataFrame): + # ADX is typically the third column in the result + return result.iloc[:, 2].fillna(method='ffill').fillna(0).values + else: + # If result is a Series, return it directly + return result.fillna(method='ffill').fillna(0).values self.indicators[ind_name] = self.I(adx_calc, self.data.High, self.data.Low, self.data.Close) elif ind_config['type'] == 'CCI':