- preprocessor include command

Miscellaneous functions
(AmiBroker 4.20)

SYNTAX #include
RETURNS nothing
FUNCTION Includes external AFL files into your formula. Note 1: include statement need SINGLE backslashes in the path (this is quite the opposite to normal AFL sting
Note 2: using #include command may slow down formula execution even
considering the fact that AmiBroker tries to include only once and cache pre-processed text
Note 3: that currently no error message is given if #include fails and this code
is experimental.
Note 4: nesting #include commands is now supported (version 5.10 and above)
Note 5: by default files #included are cached by the AmiBroker. To turn off caching use
#pragma nocache
before any #include statements. #include now accepts new way of specifying file names to include:

#include <filename.afl>

(note < > braces instead of " " ) if you specify the file name this way AmiBroker will look for the file in "standard include path" that is definable using new prefs setting in Tools->Preferences->AFL It makes much shorter to write includes and you can move include folder now without changing all AFL codes using #includes.

For example if you have set standard include path to "C:\AFL\MyIncludes" and write in your formula:

#include <common.afl>

AmiBroker will look for C:\AFL\MyIncludes\common.afl file

Also now #include reports file(s) not found in regular error message box.  

EXAMPLE #include "C:\Program Files\AmiBroker\AFL\common.afl"
SEE ALSO #pragma() function


The #include function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.