technicalindicators icon indicating copy to clipboard operation
technicalindicators copied to clipboard

incorrect calculator RSI

Open sajadonline opened this issue 4 years ago • 10 comments

hi i used rsi for calculator

const rsi = require('technicalindicators').RSI prices = [4261,4689,4400,6463,9837,13715,10285,10325] // first transaction from binance BTC var period = 3 var cal = rsi.calculate({period : period, values : prices})

when i comparison this number and rsi binance is very incorrect

code result : [ 89.6, 96.31, 98.26, 57.84, 58.14 ] //binance persent rsi period 3 from 2017/08/01 time frame 1 month 94,97,58,58,30

please help me

sajadonline avatar Apr 10 '20 12:04 sajadonline

I am also getting completely different results compared to other online tools/brokers... UP.

Vasile-Peste avatar May 05 '20 15:05 Vasile-Peste

Also different from tradingview.com RSI.

oscarmoutinho avatar Jun 25 '20 01:06 oscarmoutinho

So is this indicator is not true reliable at all?

adsonvinicius avatar Aug 10 '20 20:08 adsonvinicius

Indicator works. I have a database with over 4000 symbols with 20yrs+ data. I just checked my results against values in thinkorswim and are accurate to 1/100th.

rlmomin avatar Aug 10 '20 20:08 rlmomin

@rlmomin thanks by your info. I was checking this library issues and I could see some questions about the indicators results. Of course there are people's mistakes or misunderstandings about how to check and interpret values so I was looking for responses like yours.

adsonvinicius avatar Aug 10 '20 20:08 adsonvinicius

I think there are different views about the calculation rules. For tradingview.com RSI equivalence, I recreated RSI calc (AverageGain/AverageLoss) using WEMA (RMA). Something like: _rsi(x, y) => u = max(x - x[1], 0) // upward change d = max(x[1] - x, 0) // downward change rs = rma(u, y) / rma(d, y) res = 100 - 100 / (1 + rs) res

oscarmoutinho avatar Aug 10 '20 21:08 oscarmoutinho

I think there are different views about the calculation rules. For tradingview.com RSI equivalence, I recreated RSI calc (AverageGain/AverageLoss) using WEMA (RMA). Something like: _rsi(x, y) => u = max(x - x[1], 0) // upward change d = max(x[1] - x, 0) // downward change rs = rma(u, y) / rma(d, y) res = 100 - 100 / (1 + rs) res

Hello, I was having the same issue as the OP and tried your method (using WEMA with rsiPeriod and EMA with 1/rsiPeriod. It provided me with the same result as the original RSI from this package. Do you have any idea?

sajuuk31 avatar Dec 07 '20 09:12 sajuuk31

Could someone send a PR to have this RSI like tradingview?

yovanoc avatar Feb 12 '21 12:02 yovanoc

I think there are different views about the calculation rules. For tradingview.com RSI equivalence, I recreated RSI calc (AverageGain/AverageLoss) using WEMA (RMA). Something like: _rsi(x, y) => u = max(x - x[1], 0) // upward change d = max(x[1] - x, 0) // downward change rs = rma(u, y) / rma(d, y) res = 100 - 100 / (1 + rs) res

What's 'x' here? @oscarmoutinho

I don't see this working: Screenshot 2021-06-20 at 11 15 06 PM

Inputs please! [Btw, I'm relatively new to this arena]

saru2020 avatar Jun 20 '21 17:06 saru2020

I've found that the RSI works when all the data are given at once meaning don't feed in only period+1 or limited data per se, just input the whole list of values and the RSI indicator precisely matches the values in TV, it just works beautifully.

saru2020 avatar Nov 19 '22 16:11 saru2020