Download MetaTrader 5

Indicators: R - Squared indicator

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
183513
MetaQuotes Software Corp.  

R - Squared indicator:

r-squared indicator

Author: onur sirek

MQL4 Comments
16319
MQL4 Comments  
Great, I was just going to code a linear regression myself.
However, I found to mistakes in the code, but they'll only become obvious when looking at the slope.
I changed the regression iteration to:

for (i=0; i<=per-1; i++) {
x = per - i;

This first line was modified to get display rSquare at the correct bar
The second modification is a correction for the fact that MT4 counts the bars back. In the original code X1 is linked to Yn etc. But this only affects the slope calculation
To add comments, please log in or register