How to loop through the bars to identify first moving average cross over.

 
How to loop through the bars to identify first moving average cross over. Just the description is what I need I can code it. Am new to MQL
 
  1. Loop through each index until you find a cross.

    int i=1; for(;;++i){
       double aPrev = …(i+1), aCurr = …(i),
              bPrev = …(i+1), bCurr = …(i);
       bool   wasUp = aPrev > bPrev,
               isUp = aCurr > bCurr,
            isCross = isUp != wasUp;
       if(isCross) break;
    }
    Print("Last cross at "+i);

  2. Do you really want to find the last cross? More likely, you want to check for a cross on a new bar.

 
E-vibes:
Tnx dear. 
 
I copied only 3 data in my moving average buffer so is it possible to loop through more than what I copied in the buffer in my for loop block