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

How many days closing price should be passed to calculate RSI(14) #239

Open
kiransalian91 opened this issue Jun 6, 2021 · 4 comments
Open

Comments

@kiransalian91
Copy link

Below I am passing 15 days closing price (oldest close price first).

const rsi = this.calculateRSI.calculate({
  period: 14,
  values: [  153.6, 146.65, 146.4, 147.5, 152.7, 154.45, 150.45, 149.55, 153.6, 161.85,  160.75, 159.0, 163.85, 163.25, 161.05 ]
});

I get response as below.
console.log(rsi) // [58.67].

But actual RSI value which is displayed in Zeroda or TradingView is : 60.79.

Please help me if I am missing something here.

@saru2020
Copy link

Yes, the calculations vary b/w tradingview & RSI in this lib.
I suppose it is the duplicate of #216

@marcusmota
Copy link

the lib works, try to add more data to RSI, I think the values starts to match with the tv RSI with 100+ candles

@saru2020
Copy link

@marcusmota thanks for the reply.
Are you saying that the lib works only with 100+ candles (meaning the period should always be >100 ?) Is this documented anywhere?
I've been trying to get a fix for this issue for a very long time now. Please see if you can provide any input on this: #216 (comment)

@marcusmota
Copy link

This isn't documented, this is just how I "fixed" the issue :P the value does not need to be 100, try to add more candles until you start to have the same value of tv.

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

3 participants