Suggestion on the correct way to write this "IF" statement...

 
void CheckForMaTradeLong()
{
   
   for (int i=0; i < Bars; i++)
   {
   double i1  = iMA(NULL,60,3,0,1,0,i); 
   double i2  = iMA(NULL,60,5,0,1,0,i);
   double i3  = iMA(NULL,60,8,0,1,0,i);
   double i4  = iMA(NULL,60,10,0,1,0,i);  
   double i5  = iMA(NULL,60,12,0,1,0,i);
   double i6  = iMA(NULL,60,15,0,1,0,i);  
   double i7  = iMA(NULL,60,30,0,1,0,i);
   double i8  = iMA(NULL,60,35,0,1,0,i);
   double i9  = iMA(NULL,60,40,0,1,0,i);
   double i10 = iMA(NULL,60,45,0,1,0,i);
   double i11 = iMA(NULL,60,50,0,1,0,i);
   double i12 = iMA(NULL,60,60,0,1,0,i); 
   double ema21 = iMA(NULL,60,21,0,1,0,i);   

   if(i1>i2 && i2>i3 && i3>i4 && i4>i5 && i5>i6 && i6>i7 && i7>i8 && i8>i9 && i9>i10 && i10>i11 && i11>i12)TriggerBarTime = Time[1]; //<============= Tells me which was the right bar at the point where all MA's fanned up.

   if(i1 > i12 && Low[1]<ema21 && i12<Close[1])OrderEntry(0)  //OrderEntry sends a buy stop order out.
   
   if(Close[1]<i12)DeleteOrder(0);  //Delete the pending order. 
   {
   return(i-1);
   }
   }

If someone could be kind enough to shed some light on this...

I need to know which was the bar where all the MA's fanned up... which I have.... If this is true, then it needs to move onto the next IF statement. However, when it moves onto the next "IF" statement, all the moving averages DO NOT need to remain in the correct order as stated in the first IF statement (indicated with the arrow).

Instead, what I am wanting to make sure is that price close, remains above the 60 EMA, (irrelevant of the moving averages being stacked up on top of each other in the right order...) else it needs to run the loop again to determine the point where all the moving averages are fanned up again....

 
Don't double post
 
Sorry - I was under the impression it was better to post a new topic as opposed to asking multiple different questions under one topic?
 
Same code, same problems, continuations of the same topic.
Reason: