[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] "break" statement in AFL



PureBytes Links

Trading Reference Links

Dan,

I wasn't sure exactly when you wanted to exit the loop but this will
exit when the sDateString var contains a string or the loop reaches EOF.


fh = fopen( "C:\\Program Files\\AmiBroker\\LookupData\\" + Symbol + ".csv ", "r");
sDateString = "";
if( fh ) 
        { 
        while( ! feof( fh ) OR sDateString == "") 
                { 
                CurRow = fgets( fh );
                if (StrExtract(CurRow, 0) == "YHEDDate")
                        sDateString = StrExtract(CurRow, 1);
                } 
        fclose( fh ); 
}


Regards,
William Peters
http://www.amitools.com




Friday, December 23, 2005, 9:13:00 PM, you wrote:
DC> Hi,

DC> I'm trying to maximize the speed of a text lookup that involves a "While"
DC> loop (code sample below).  The traditional way of breaking out of a "While"
DC> loop is to use a "break" statement (or something similar).     

DC> I can't find anything similar to a "break" statement in AFL.  Did I miss
DC> it?   Any workarounds?

DC> Thanks and regards,

DC> Dan.

DC> p.s., Yes, I know that reading from a file won't be super-fast.  If I can
DC> prove my concept and see a performance hit, I'll try the Osaka plugin or
DC> something similar.


DC> fh = fopen( "C:\\Program Files\\AmiBroker\\LookupData\\" + Symbol + ".csv ",
DC> "r"); 
DC> if( fh ) 
DC>         { 
DC>         while( ! feof( fh )                       ) 
DC>                 { 
DC>                 CurRow = fgets( fh );
DC>                 if (StrExtract(CurRow, 0) == "YHEDDate")
DC>                         sDateString = StrExtract(CurRow, 1);
DC>                 } 
DC>         fclose( fh ); 
DC> } 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/