Hello,

DateNum is a number in the format YYYMMDD
where YYY is year-1900, MM is month, DD is day.
2007-1-1 should be written as:
1070101

Best regards,
Tomasz Janeczko
amibroker.com

On 2010-04-26 14:41, wavemechanic wrote:


*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 <mailto:[email protected]>
    *To:* [email protected] <mailto:[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



    
<http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline....@middle?>





Reply via email to