John,Originally Posted by ;
The statement
for(int I=0;ilt;20;I )
sets up a 'loop'.
-- The segment before the first semi-colon int I=0 determines the start standards, i.e. the variable is set to a value of 0.
-- The segment prior to the second semi-colon ilt;20 decides the condition required to maintain the loop 'living', i.e. I should remain less than 20. The moment this condition no longer exists, i.e. I reaches a value of 20, the loop ends, and the program procced with the first statement outisde the curly braces, i.e.
averageval = averageval / 20 ;
-- The segment before the second semi-colon ilt;20 occurs during each iteration of the loop. I is permissible shorthand for I=I 1, i.e. increase the value of I by 1. Everything within the curly braces
averageval = averageval myarray[I] ;
gets implemented just prior to the value of being increased.
See http://docs.mql4.com/basis/operators/for for More Information.