-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Hello,
I've been using the RSI indicator provided by ta
.
Using the RSI indicator, I compute some higher level indicators, their form is not important here.
I wanted to verify that I had implemented the indicator correctly, and so I wrote extensive test cases on real data lifted from TradingView.
This is when I noticed that the RSI value computed on TradingView does not match the RSI computed from this library.
I figured out the issues here:
- The EMAs internal to the
ta
RSI use a different alpha (k
field), as2 / (period - 1)
, whereas on TV, the RSI uses an EMA with alpha of1.0 / period
. - The computation of the RSI on TV uses a form that handles division by zero differently, otherwise the expressions should be equivalent.
I am not sure which version of the RSI is the intended "official" RSI,
but in order to make the RSI implementations match I've had to change things inside the ta
library.
If you have any information on this please let me know, I am a bit clueless.
My suggested change is that you provide a function on EMA
and dependent indicators to set the alpha parameter used.