didn't know you wanted to verify file exist... I use include parameters calculated from within the code. They basically contain long list of
Par1 = nnnn;
Par2 = mmmm;
etc.
by placing the include strategically it will be read when needed, even conditionally by adding an IF() in the include. I read those at the top of the code (very fast). This speeds up execution enormously. You can also dynamically create other afl code this way. Its a nice way to save ticker specific parameters without have to calculate them on each pass. You can check file exist with fgetstatus(), see below. by reading the date you can also prevent working with old data...
good luck,
herman
FGETSTATUS
- retrieves file status/properties
|
File Input/Output functions
(AFL 2.90)
|
SYNTAX
|
fgetstatus( filename, what, format = 0 )
|
RETURNS
|
NUMBER or STRING
|
FUNCTION
|
The function that retrieves file properties/status.
Returns NUMBER or STRING depending on format parameter. If file does not exist it returns Null.
Parameters:
filename - the name of the file (with or without full path) to query
what - specifies what file property to retrieve, allowable values
0 - the date/time the file was created
1 - the date/time the file was last modified
2 - the date/time the file was last accessed for reading
3 - the file size in bytes
4 - attribute byte of the file
format - specifies return format of date/time values (format specifications are the same as in Now() function): allowed values:
0 - returns string containing date/time formatted according to system settings
1 - returns string containing date only formatted according to system settings
2 - returns string containing time only formatted according to system settings
3 - returns DATENUM number with date
4 - returns TIMENUM number with time
5 - returns DATETIME number with date/time
6 - returns date DAY (1..31)
7 - returns date MONTH (1..12)
8 - returns date YEAR (four digit)
9 - returns date DAY OF WEEK (1..7, where 1=Sunday, 2=Monday, and so on)
10 - returns date DAY OF YEAR (1..366)
Note that Windows supports only 2 second resolution of file date/time stamps.
|
For tips on developing Real-Time Auto-Trading systems visit:
http://www.amibroker.org/userkb/
Saturday, February 9, 2008, 1:19:48 PM, you wrote:
>> use static variables, they return NULL when not yet initialized.
> Herman,
> Thanks much for the suggestion. That's the first thing I tried.
> There seems to be a lifetime issue with the static variables from the
> point-of-view of what I'm trying to accomplish.
> What I think I'm observing is that if a static was ever defined while
> AB is open, then that definition is retained even though one comments
> out the include file that did the definition in the first place.
> I'm sure this behavior is desirable for many things, but in the
> scenario I posit, I need the absence of the include file to definitely
> create a NULL/FALSE situation.
> __
> As for VarGet() and VarGetText(), some explicit documentation on what
> they return when supplied with a variable name that does not exist
> would be helpful.
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 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/
> <*> Your email settings:
> Individual Email | Traditional
> <*> To change settings online go to:
> http://groups.yahoo.com/group/amibroker/join
> (Yahoo! ID required)
> <*> To change settings via email:
> mailto:amibroker-digest@xxxxxxxxxxxxxxx
> mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
> <*> 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/
>
__._,_.___
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|