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

RSI calculation bug? #637

Open
jencijanos opened this issue Jan 21, 2024 · 3 comments
Open

RSI calculation bug? #637

jencijanos opened this issue Jan 21, 2024 · 3 comments

Comments

@jencijanos
Copy link

found a problem in the calculations RSI. df['RSI_14_close'] = RSI(df, timeperiod=14) give me

date,open,high,low,close,RSI_14_close
2024-01-21 00:30:00,1.324e-05,1.331e-05,1.323e-05,1.327e-05,
2024-01-21 00:45:00,1.327e-05,1.33e-05,1.326e-05,1.327e-05,
2024-01-21 01:00:00,1.327e-05,1.33e-05,1.317e-05,1.324e-05,
2024-01-21 01:15:00,1.323e-05,1.325e-05,1.323e-05,1.325e-05,
2024-01-21 01:30:00,1.324e-05,1.325e-05,1.321e-05,1.325e-05,
2024-01-21 01:45:00,1.324e-05,1.327e-05,1.324e-05,1.327e-05,
2024-01-21 02:00:00,1.326e-05,1.327e-05,1.325e-05,1.326e-05,
2024-01-21 02:15:00,1.326e-05,1.327e-05,1.325e-05,1.327e-05,
2024-01-21 02:30:00,1.327e-05,1.328e-05,1.325e-05,1.327e-05,
2024-01-21 02:45:00,1.327e-05,1.327e-05,1.324e-05,1.326e-05,
2024-01-21 03:00:00,1.326e-05,1.327e-05,1.324e-05,1.327e-05,
2024-01-21 03:15:00,1.326e-05,1.329e-05,1.326e-05,1.328e-05,
2024-01-21 03:30:00,1.329e-05,1.329e-05,1.327e-05,1.328e-05,
2024-01-21 03:45:00,1.328e-05,1.33e-05,1.327e-05,1.33e-05,
2024-01-21 04:00:00,1.33e-05,1.33e-05,1.328e-05,1.33e-05,0.0
2024-01-21 04:15:00,1.33e-05,1.331e-05,1.33e-05,1.33e-05,0.0
2024-01-21 04:30:00,1.33e-05,1.33e-05,1.328e-05,1.328e-05,0.0
2024-01-21 04:45:00,1.329e-05,1.329e-05,1.326e-05,1.329e-05,0.0
2024-01-21 05:00:00,1.329e-05,1.329e-05,1.327e-05,1.327e-05,48.02516157768909
2024-01-21 05:15:00,1.328e-05,1.329e-05,1.327e-05,1.328e-05,51.66093531184409
2024-01-21 05:30:00,1.329e-05,1.329e-05,1.327e-05,1.329e-05,55.0473756916628
2024-01-21 05:45:00,1.328e-05,1.33e-05,1.327e-05,1.33e-05,58.20090420105429
2024-01-21 06:00:00,1.329e-05,1.33e-05,1.327e-05,1.328e-05,50.56124249753458
2024-01-21 06:15:00,1.328e-05,1.33e-05,1.327e-05,1.329e-05,53.82491650741884
2024-01-21 06:30:00,1.329e-05,1.329e-05,1.326e-05,1.326e-05,44.36323416932482
2024-01-21 06:45:00,1.326e-05,1.327e-05,1.326e-05,1.327e-05,47.66567506367998
2024-01-21 07:00:00,1.327e-05,1.328e-05,1.326e-05,1.328e-05,50.81004942611891
2024-01-21 07:15:00,1.327e-05,1.328e-05,1.325e-05,1.326e-05,44.98820062387063
2024-01-21 07:30:00,1.326e-05,1.328e-05,1.325e-05,1.328e-05,51.030740499714675
2024-01-21 07:45:00,1.327e-05,1.327e-05,1.325e-05,1.326e-05,45.63282909230429
2024-01-21 08:00:00,1.325e-05,1.326e-05,1.324e-05,1.324e-05,40.966190717700854
2024-01-21 08:15:00,1.325e-05,1.326e-05,1.324e-05,1.325e-05,44.0472689820242
2024-01-21 08:30:00,1.324e-05,1.326e-05,1.324e-05,1.325e-05,44.0472689820242
2024-01-21 08:45:00,1.326e-05,1.327e-05,1.325e-05,1.326e-05,47.24078857317984
2024-01-21 09:00:00,1.326e-05,1.327e-05,1.324e-05,1.325e-05,44.50524180500565
2024-01-21 09:15:00,1.324e-05,1.325e-05,1.324e-05,1.324e-05,41.89277478880581
2024-01-21 09:30:00,1.325e-05,1.325e-05,1.323e-05,1.323e-05,39.40195609170993
2024-01-21 09:45:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,43.048589907178076
2024-01-21 10:00:00,1.323e-05,1.324e-05,1.322e-05,1.324e-05,43.048589907178076
2024-01-21 10:15:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,43.048589907178076
2024-01-21 10:30:00,1.323e-05,1.325e-05,1.323e-05,1.324e-05,0.0
2024-01-21 10:45:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,0.0
2024-01-21 11:00:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,0.0
2024-01-21 11:15:00,1.324e-05,1.326e-05,1.323e-05,1.325e-05,0.0
2024-01-21 11:30:00,1.325e-05,1.326e-05,1.324e-05,1.326e-05,0.0
2024-01-21 11:45:00,1.326e-05,1.327e-05,1.325e-05,1.326e-05,0.0
2024-01-21 12:00:00,1.326e-05,1.327e-05,1.325e-05,1.325e-05,0.0
2024-01-21 12:15:00,1.326e-05,1.326e-05,1.324e-05,1.324e-05,0.0
2024-01-21 12:30:00,1.325e-05,1.325e-05,1.322e-05,1.323e-05,0.0
2024-01-21 12:45:00,1.324e-05,1.325e-05,1.322e-05,1.324e-05,0.0

zero in last 10 line.

same input data calculated using pandas-ta give "other" result

...
2024-01-21 08:00:00,1.325e-05,1.326e-05,1.324e-05,1.324e-05,40.18228008822393
2024-01-21 08:15:00,1.325e-05,1.326e-05,1.324e-05,1.325e-05,43.557040811558295
2024-01-21 08:30:00,1.324e-05,1.326e-05,1.324e-05,1.325e-05,43.557040811558295
2024-01-21 08:45:00,1.326e-05,1.327e-05,1.325e-05,1.326e-05,47.02334768897121
2024-01-21 09:00:00,1.326e-05,1.327e-05,1.324e-05,1.325e-05,44.10630620385045
2024-01-21 09:15:00,1.324e-05,1.325e-05,1.324e-05,1.324e-05,41.34427175267467
2024-01-21 09:30:00,1.325e-05,1.325e-05,1.323e-05,1.323e-05,38.73219915753848
2024-01-21 09:45:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,42.63521193429178
2024-01-21 10:00:00,1.323e-05,1.324e-05,1.322e-05,1.324e-05,42.635211934291775
2024-01-21 10:15:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,42.635211934291775
2024-01-21 10:30:00,1.323e-05,1.325e-05,1.323e-05,1.324e-05,42.635211934291775
2024-01-21 10:45:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,42.635211934291775
2024-01-21 11:00:00,1.324e-05,1.325e-05,1.323e-05,1.324e-05,42.63521193429178
2024-01-21 11:15:00,1.324e-05,1.326e-05,1.323e-05,1.325e-05,47.820530475251424
2024-01-21 11:30:00,1.325e-05,1.326e-05,1.324e-05,1.326e-05,52.44935913524291
2024-01-21 11:45:00,1.326e-05,1.327e-05,1.325e-05,1.326e-05,52.449359135242915
2024-01-21 12:00:00,1.326e-05,1.327e-05,1.325e-05,1.325e-05,47.55662274186611
2024-01-21 12:15:00,1.326e-05,1.326e-05,1.324e-05,1.324e-05,43.215193045925396
2024-01-21 12:30:00,1.325e-05,1.325e-05,1.322e-05,1.323e-05,39.34691942233122
2024-01-21 12:45:00,1.324e-05,1.325e-05,1.322e-05,1.324e-05,44.679657715934646
2024-01-21 13:00:00,1.324e-05,1.325e-05,1.324e-05,1.325e-05,49.464611017551896

macos monterey
Python 3.11.1
ta-lib 0.4.0

python modules:
Cython==3.0.8
numpy==1.26.3
pandas==2.1.4
pycparser==2.21
requests==2.31.0
scipy==1.11.4
TA-Lib==0.4.28

pytest passed witout any error

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Jan 21, 2024 via email

@jencijanos
Copy link
Author

@mrjbq7 thanks for the quick response, and your link to issue #157. This "feature" make unusable implementation of TAlib in python for me... or is there some universal solution?

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Jan 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants