hi, what the code below does: it calculates "Setup" which has a "1" where ever 
C closes below the BBandBOT. Then I subject the array "Setup" to the loop. When 
inside the "i" loop and it finds a "1" then it enters the "j" loop and will 
make a number of "waitPeriod" bars "0" that follow the "1" bar at bar "i". When 
finished with the "j" loop I tell it that i = j so that it enters the "i" loop 
at the value of "j" etc.

So basicly if a "1" is found in the array "Setup" it zeros out the next 
"waitPeriod" bars.  I do not know of an array based calculation in AFL that 
could do it more simple.


SetBarsRequired(10000,10000); 

triggerPercentage = 1.03; 
waitPeriod = 15; 

Setup = C < BBandBot(C,20,2); 

for (i = 0; i < BarCount - waitPeriod; i++) { 

   if (Setup[ i ]) { 

      for (j = i + 1; j < i + waitPeriod; j++) { 
       
         Setup[ j ] = 0; 
       
      } 

      i = j; 

   } 

} 




  ----- Original Message ----- 
  From: bernardedmond01 
  To: [email protected] 
  Sent: Friday, March 23, 2007 1:26 AM
  Subject: [amibroker] Re: Hold and Valuewhen functions


  Edward
  Would you mind translating into plain English the for - if loop 
  please? I've looked at the examples in the user's guide but I can't 
  follow the AFL.
  Thanks



   

Reply via email to