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

RSI Calculation #19

Open
J-Addy opened this issue Mar 11, 2021 · 0 comments
Open

RSI Calculation #19

J-Addy opened this issue Mar 11, 2021 · 0 comments

Comments

@J-Addy
Copy link

J-Addy commented Mar 11, 2021

I'm a newer graduate (so I am not 100% confident in this), but I am pretty sure that the method used in this calculation is a standard weighted average instead of "Wilder's" weighted average. In order to get Wilder's we need to recursively calculate the average based on the previous averages. This can be fixed by changing the ewm method for up and down days to :

    # Calculate the EWMA for the Up days.
    self._frame['ewma_up'] = self._price_groups['up_day'].transform(
        lambda x: x.ewm(alpha=1.0 / period,adjust=False).mean()
    )

Also, when putting the Relative Strength index into the dataframe, the given method only returned values over 95. So I modified it to directly put the Relative strength index variable into the dataframe. Although, when I look at the given method, I am not sure why it doesn't work. Essentially no RSI values should ever be 0 or 100, so wouldn't the np.where statement parameters 0, 100 be essentially ignored?

    # Calculate the Relative Strength Index
    self._frame['rsi'] = 100.0 - (100.0 / (1.0 + relative_strength))
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

1 participant