I want to code a linear regression of the 5 last Bars and i need the summation of the closes of the last 5 bars so i wrote this.
double sum_y = 0;
int sum_x = 0;
for(i=1; i<=5; i++)
sum_y += Close[i];
sum_x += i;
I just want sum_y = Close+Close+Close+Close+Close
Ye you are right with sum_x. I dont need to calculate that for linear regression.
Variables are global.
sum_x += 1;
To add comments, please log in or register