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 #613

Open
eugenpro opened this issue Sep 3, 2023 · 4 comments
Open

RSI calculation #613

eugenpro opened this issue Sep 3, 2023 · 4 comments

Comments

@eugenpro
Copy link

eugenpro commented Sep 3, 2023

Hello. During usage RSI function I've touched that with the same timeperiods e.g. 14 RSI still changes depending on data size. for instance if I calculate RSI from 1 Jan 2023 to 01 Aug 2023 or 1 Jan 2022 to 01 Aug 2023 RSI value on 01 Jun 2023 will be different in both cases that makes me crasy. How to reach RSI cosistensy across the time?

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Sep 3, 2023

Probably has to do with it's definition in TA-Lib, using smoothing:

https://github.com/TA-Lib/ta-lib/blob/main/src/ta_func/ta_RSI.c#L341

@bttger
Copy link

bttger commented Nov 30, 2023

@eugenpro how big is the difference for you?

@mario4tier
Copy link
Member

This is how RSI works (and any function designated to have an "unstable period" in TA-Lib).

Because the smoothing is recursive, adding/removing to the length of the input will cause a slightly different output.

This is the nature of how the RSI algo works. There is no fix needed to TA-Lib.

If you want strict consistency, you have to make a choice how to handle it in your app. As an example, you can choose to always start your input on 1 jan 2022 for this time series even if later you have access to the 2021 data.

TA-Lib also offer ways to enforce a minimum of inputs to reduce inconsistency (check for setting the unstable period for individual functions).

@mario4tier
Copy link
Member

@bttger the difference depends highly of the input variance and how many data you input to the function. I assume most apps just feed all the data they have, and that is an OK approach to it.

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

4 participants