how the MT4 distinguish between the "resultTotal" before the = as a new total that will have a new value assigned to it after operating the left side after the equal, and "resultTotal" that is on the left side after the equal as old value?
double resulttotal;
double resultaverage;
int totalbar = 10;
for(int x = 1; x <= totalbar; x++) {resulttotal = resulttotal + iClose(NULL, 0 , x); }
resultaverage = resulttotal / totalbar;
------------------------------------------------------------------------------------------------------------------------------------
what confusing me is that in the example I set resulttotal will have 2 different values because of the looping
if we said that resulttotal will start off by being equal to zero and we have a candle close that is equal to 1.9231, so it will be as follow
resulttotal = resulttotal + iClose(NULL, 0 , x);
resulttotal = 0 + 1.9231
so now I think the resulttotal will be equal to 1.9231 But on the second loop I see it as follow
1.9231 = 1.9231 + 1.9341
Which I does not understand unless I see the "resulttotal" that is before the equal as variable empty but it is not because it has a value of 1.9231 and this value has been applied by the system to the "resulttotal" that came after the = sign on the same line
So my question how the system sees the first "resulttotal" that is before the equal still as a variable that can be changed while the "resulttotal" after the equal as a variable that has a value
double resulttotal;
double resultaverage;
int totalbar = 10;
for(int x = 1; x <= totalbar; x++) {resulttotal = resulttotal + iClose(NULL, 0 , x); }
resultaverage = resulttotal / totalbar;
------------------------------------------------------------------------------------------------------------------------------------
what confusing me is that in the example I set resulttotal will have 2 different values because of the looping
if we said that resulttotal will start off by being equal to zero and we have a candle close that is equal to 1.9231, so it will be as follow
resulttotal = resulttotal + iClose(NULL, 0 , x);
resulttotal = 0 + 1.9231
so now I think the resulttotal will be equal to 1.9231 But on the second loop I see it as follow
1.9231 = 1.9231 + 1.9341
Which I does not understand unless I see the "resulttotal" that is before the equal as variable empty but it is not because it has a value of 1.9231 and this value has been applied by the system to the "resulttotal" that came after the = sign on the same line
So my question how the system sees the first "resulttotal" that is before the equal still as a variable that can be changed while the "resulttotal" after the equal as a variable that has a value