For one thing the date format is wrong.  Look at the syntax in Help or on the 
website at http://www.amibroker.com/guide/afl/afl_view.php?id=37


  ----- Original Message ----- 
  From: mahesh 
  To: [email protected] 
  Sent: April 26, 2010 1:07 AM
  Subject: [amibroker] plz point out what's going with this AFL





  dear members
  I tried the following code in commentary(to find bars between 2 dates) as 
suggested by TJ.

  bi=BarIndex();

  bi1=ValueWhen(DateNum()=2007-1-1,bi);

  bi2=ValueWhen(DateNum()=2007-12-1,bi);

   numbars=LastValue(bi1-bi2);

  WriteVal(numbars);

  (1)but i got the following error-



  Error in AFL formula:

  bi2=ValueWhen(DateNum()=2007-12-1,bi); 
   
   
  numbars=LastValue(bi1-bi2)
  -------------------------^

  Error 29.
  Variable 'bi2' used without having been initialized.

  (2)plz in what format DateNum accepts the date? whether in quotes?

  regards 
  mahesh



   


   


  

Reply via email to