Skip to content

RSI value does NOT match expected values #46

@wbrickner

Description

@wbrickner

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:

  1. The EMAs internal to the ta RSI use a different alpha (k field), as 2 / (period - 1), whereas on TV, the RSI uses an EMA with alpha of 1.0 / period.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions