Indicators: R - Squared indicator

 

R - Squared indicator:

r-squared indicator

Author: onur sirek

 
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
Reason: