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

Schaff trend cycle (STC) giving negatively biased results: bug? #699

Open
halterc opened this issue Jun 26, 2023 · 1 comment
Open

Schaff trend cycle (STC) giving negatively biased results: bug? #699

halterc opened this issue Jun 26, 2023 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@halterc
Copy link

halterc commented Jun 26, 2023

Which version are you running? The lastest version is on Github. Pip is for major releases.
pandas_ta: 0.3.14b0

Do you have TA Lib also installed in your environment?
Yes: TA-Lib: 0.4.19

Have you tried the development version? Did it resolve the issue?
No

Describe the bug
The values are always negatively biased, using ta.stc(x).iloc[:, 0].mean(). The indicator ranges from 0-100. I would expect a mean of 50. However, what I observe is always around 20. I tested ta.stc with different datasets and default parameters (or any other meaningful combination: I also tested changing each single parameter at a time).
For comparison, using the same data, the finta TA.STC(x).mean() consistently results in a mean of around 50, as would be expected.

To Reproduce

import yfinance as yf
import pandas_ta as ta
from finta import TA

x = yf.download('ABB.NS', start = "2021-12-08", end = "2023-01-01", progress = False)
ta.stc(x['Close']).iloc[:, 0].mean()
TA.STC(x[['Open', 'Low', 'High', 'Close']]).mean()
pandas_ta result: 17.77649708406015
finta result:          47.476128567356724

Expected behavior
Value should be equal (or at least comparable) to finta result and around 50.
(also, stc calculation in finta seems a lot faster)

Thanks for developing Pandas TA! 😄 👍

@halterc halterc added the bug Something isn't working label Jun 26, 2023
@twopirllc twopirllc removed their assignment Jun 26, 2023
@twopirllc twopirllc added the help wanted Extra attention is needed label Jun 26, 2023
@twopirllc
Copy link
Owner

Hello @halterc,

Apologies for not addressing this sooner. 😓

I am not too familiar with the internals of stc but perhaps the author @rengel8 may have an idea. 😎

Whenever I get a chance to revamp stc, or anyone else for that matter, they can compare with finta's version. ✅

Kind Regards,
KJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants