How many days closing price should be passed to calculate RSI(14)
kiransalian91 opened this issue · 4 comments
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.
Yes, the calculations vary b/w tradingview & RSI in this lib.
I suppose it is the duplicate of #216
the lib works, try to add more data to RSI, I think the values starts to match with the tv RSI with 100+ candles
@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)
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.