Download MetaTrader 5

Indicators: R - Squared indicator

To add comments, please log in or register
How to buy a product in MetaTrader AppStore? Read the article!
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2007.11.14 12:13 

R - Squared indicator:

r-squared indicator

Author: onur sirek

MQL4 Comments
MQL4 Comments 2007.11.16 19:59  
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