Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Most of the indicators returns NaN. #626

Open
benimadimkadir opened this issue Dec 3, 2022 · 5 comments
Open

Most of the indicators returns NaN. #626

benimadimkadir opened this issue Dec 3, 2022 · 5 comments
Labels
good first issue Good for newcomers info Informational

Comments

@benimadimkadir
Copy link

benimadimkadir commented Dec 3, 2022

Pandas_ta version: 0.3.14b0
Python version: Python 3.8.10
Ta-Lib is installed. Ta-Lib version: 0.4.24

Most of the indicators return Nan. Only a few indicators work.

import numpy as np
import pandas as pd
import pandas_ta as ta

data=np.genfromtxt("b15.csv",delimiter=",")
df=pd.DataFrame(data,columns=["Time","Open","High","Low","Close","Volume"])
e=ta.momentum.macd(close=df["Close"])
print(e)
                            MACD_12_26_9  MACDh_12_26_9  MACDs_12_26_9
Time                                                                  
1970-01-01 00:26:17.836800           NaN            NaN            NaN
1970-01-01 00:26:17.837700           NaN            NaN            NaN
1970-01-01 00:26:17.838600           NaN            NaN            NaN
1970-01-01 00:26:17.839500           NaN            NaN            NaN
1970-01-01 00:26:17.840400           NaN            NaN            NaN
...                                  ...            ...            ...
1970-01-01 00:27:47.256300           NaN            NaN            NaN
1970-01-01 00:27:47.257200           NaN            NaN            NaN
1970-01-01 00:27:47.258100           NaN            NaN            NaN
1970-01-01 00:27:47.259000           NaN            NaN            NaN
1970-01-01 00:27:47.259900           NaN            NaN            NaN

[98980 rows x 3 columns]

Vortex works:

e=ta.trend.vortex(close=df["Close"],high=df["High"],low=df["Low"])
print(e)
                             VTXP_14   VTXM_14
Time                                          
1970-01-01 00:26:17.836800       NaN       NaN
1970-01-01 00:26:17.837700       NaN       NaN
1970-01-01 00:26:17.838600       NaN       NaN
1970-01-01 00:26:17.839500       NaN       NaN
1970-01-01 00:26:17.840400       NaN       NaN
...                              ...       ...
1970-01-01 00:27:47.256300  1.157145  0.864892
1970-01-01 00:27:47.257200  1.152978  0.886676
1970-01-01 00:27:47.258100  1.184268  0.856069
1970-01-01 00:27:47.259000  1.219873  0.828368
1970-01-01 00:27:47.259900  1.238993  0.761392

[98980 rows x 2 columns]
@benimadimkadir benimadimkadir added the bug Something isn't working label Dec 3, 2022
@twopirllc twopirllc removed their assignment Dec 5, 2022
@twopirllc twopirllc added good first issue Good for newcomers info Informational and removed bug Something isn't working labels Dec 5, 2022
@twopirllc
Copy link
Owner

Hello @benimadimkadir,

Interesting. 🤔

Could you share some 500 rows of your csv?

Kind Regards
KJ

@benimadimkadir
Copy link
Author

benimadimkadir commented Dec 10, 2022

Hello @benimadimkadir,

Interesting. thinking

Could you share some 500 rows of your csv?

Kind Regards KJ

Also, Talib returns same results. I tried with dataframe has 1000 rows, it works in both Pandas_ta and Talib functions. I am not sure, but I think they both have this problem with the algorithms they have in common. Talib doesn't have Vortex indicator, therefore Pandas_ta's Vortex indicator works.

For now I'm dividing the data into small parts and using them as input and than combine the results.

This is the first 500 row:
first-500-row.csv
This is the full file:
b15.csv

@twopirllc
Copy link
Owner

@benimadimkadir,

I tried with dataframe has 1000 rows, it works in both Pandas_ta and Talib functions.

I do not understand. What works? All the indicators? You ran Pandas TA indicators separate from TA Lib indicators and go the same results? It only works with up to 1000 rows? How many rows does it work up to? 1500? 2000? 3000? 5000? 10000?

I am not sure, but I think they both have this problem with the algorithms they have in common. Talib doesn't have Vortex indicator, therefore Pandas_ta's Vortex indicator works.

I dubious of that claim without hard evidence.

KJ

@akwritescode
Copy link

ok i thought i faced the same issue until i changed the number of rows i fed to the library

@emranalus
Copy link

I was about to open a issue then I saw this post for me every indicator I wanted worked but EOM only gets calculated instead of returning a all NaN dataframe if length of the data is smaller here is what I found.

2022-11-18 18:49:59.999 -0.608464
2022-11-18 18:54:59.999 -0.562584
2022-11-18 19:04:59.999 -0.960945
2022-11-18 19:09:59.999 -0.772009
Name: EOM_20_10000, Length: 43310, dtype: float64

2022-11-18 18:49:59.999 NaN
2022-11-18 18:54:59.999 NaN
2022-11-18 19:04:59.999 NaN
2022-11-18 19:09:59.999 NaN
Name: EOM_20_10000, Length: 50528, dtype: float64

There is something between 43.3k bars input and 50.5k bars input that makes the library spit out all NaN, just wanted to give feedback also tested with different csv's acts the same when length is above 43.3k bars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers info Informational
Projects
None yet
Development

No branches or pull requests

4 participants