-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Question about RSI implementation #68
Comments
Hi! So sorry for my very late response. I was on a trip, and just had a chance to take a look at this. First of all, thank you very much for taking the time to write such a descriptive bug report. Very much appreciated definitely. I looked at your calculations document, and I noticed that on Column F, you are calculating the SMA with =SUM(D3:D16)/14 but afterwards, you are using =((F16*13)+D17)/14 for the remaining rows. I guess that is the reason for the difference in the results. I copied your calculations document, and added the columns J and K to calculate the SMA through the =SUM()/14 method, and I was able to get results aligned with the ones calculated by the page at rows 92 to 101. Could you take a look? I hope it didn't miss anything. https://docs.google.com/spreadsheets/d/1e3r1mBAQNXd3yI2l-CiEls0Pfn3mRGv_jxTVJ8kNT9Q/edit?usp=sharing |
@cinar Thanks for responding!
The logic here is that on the 15th closing I calculate the average of the previous 14 values, after that, I calculate the weighted average using I would be glad to take a look if you allow the document for reading :) |
@cinar Looks like I found the answer, to why my calculations are the same as on the Binance but differ from those provided by this library. The Binance exchange uses the TradingView plots. If we take a look at the TradingView RSI documentation we will see, that in their RSI formula they use the Rolling Moving Average: which in its turn has exact the same formula that I used in my calculations (screenshot is taken from here): While in this library for the RSI calculation the Simple Moving Average is used. During my further research, I found out, that the first average gain and all subsequent should be calculated slightly differently. Here's what I found on the stockcharts.com: The same is told on quantinsti.com: Not an expert, but it's clear to me that the current RSI implementation differs a bit. What do you think about it? |
You got me convinced! :) I will take a look and update the calculation here. |
* Adding rolling moving average (RMA) indicator. * Adding RMA to index. * Changing RSI to use RMA indicator. Fixes #68.
Hi! First of all, I would like to thank you for this great package.
Recently I tested the RSI indicator, and I found some divergence in the RSI values produced by this package and values calculated by myself and other tools. Just wanted to find out why is it so.
Here's an example of closing values:
The code below prints these values:
I've calculated the RSI values manually (using google sheets) and got these values:
The document with my calculations is available here.
My calculations match the values from the Binance exchange.
Looking into the implementation of the package, I've found that the moving average values and the RSI values are available starting from the 3rd closing value, which is strange because the average value of the 14 closing values should be available starting from the 15th closing value. These MA issues are the point where my calculations start to diverge with the work of this package.
So I wanted to ask and ensure whether there are no mistakes in the RSI implementation. If not, could you please elaborate on what I've done wrong in my calculations and why they match the Binance exchange values? Thank you in advance.
The text was updated successfully, but these errors were encountered: