jealous / stockstats

Supply a wrapper ``StockDataFrame`` based on the ``pandas.DataFrame`` with inline stock statistics/indicators support.
Other
1.29k stars 299 forks source link

Different results in DMI indicators (ex: adx_X_ema) between 0.5.X and 0.6.X. #182

Open truchindedios opened 11 months ago

truchindedios commented 11 months ago

If we compute the same indicators, with same code/data we obtain different results between branchs 0.5.X and 0.6.X. In this screen capture you have same code executing with 2 clone conda env , only changing the stockstats version. Which of them is correct? stockstatsADX

df_prices_l[['tic','volume','high','low','open','close']].tail() Field tic volume ... open close date ...
2023-11-02 945384 24946.0 ... 35.31 35.90 2023-11-02 945388 35788.8 ... 15.62 15.73 2023-11-02 992816 77334.8 ... 175.52 177.57 2023-11-02 993249 8135.1 ... 102.05 105.08 2023-11-02 998171 3628.0 ... 290.25 294.53

stock = Sdf.retype(df_prices_l.copy()) stock['adx_5_ema']

VERSION 0.5.4 stock[['tic','close','adx_5_ema']] Field tic close adx_5_ema date
2023-01-03 13967E 66.25 NaN 2023-01-03 28236L 134.78 100.000000 2023-01-03 51683M 207.39 100.000000 2023-01-03 542868 47.94 81.839948 2023-01-03 696738 346.22 71.437125 ... ... ... ... 2023-11-02 945384 35.90 16.147743 2023-11-02 945388 15.73 15.958998 2023-11-02 992816 177.57 15.557359 2023-11-02 993249 105.08 13.905666 2023-11-02 998171 294.53 14.194133

VERSION 0.6.0 stock[['tic','close','adx_5_ema']] Field tic close adx_5_ema date
2023-01-03 13967E 66.25 NaN 2023-01-03 28236L 134.78 100.000000 2023-01-03 51683M 207.39 100.000000 2023-01-03 542868 47.94 80.787141 2023-01-03 696738 346.22 70.113103 ... ... ... ... 2023-11-02 945384 35.90 7.794167 2023-11-02 945388 15.73 7.855445 2023-11-02 992816 177.57 7.757818 2023-11-02 993249 105.08 6.994558 2023-11-02 998171 294.53 7.368469

Thanks for you code!! It's really good!!