Hello,
#include is not regular function. It is
pre-processor command that is executed ONCE before any execution takes
place.
This is so for speed because including at execution
stage over and over again will slow down the execution
significantly.
It works the same way as C language
pre-processor.
Instead I suggest using OLE automation to backtest
all variants. Batch backtesting is described in the User's Guide:
There is a BatchTest.js script file that will
automatically run backtest ON EACH file stored in selected
directory.
So simply put all files you want to test in one
separate directory, adjust this line in the script
AFLFolder =
"C:\\Program Files\\AmiBroker\\AFL"; // MODIFY TO FIT YOUR
SETUP
and double click BatchTest.js (the file with the
script) - that way you will launch Windows Scripting host
that will run the script that executes all
backtests.
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Monday, November 14, 2005 10:37
AM
Subject: [amibroker] #Include
Hello,
I posted this question in boards, but did not get
an answer. Could someone give any ideas,
please:
------------------------------- I am trying to user
Optimizer to test 100.000 formations stored in separate .afl files. I want to
use #include in something like this:
i = Optimize ("i", 1, 1,
10000, 1); FileName = "MyFile" + i + ".afl"; #include
Filename;
However, this does not work, as apparantely you cannot pas a
string as a file name to #include
preproccessor.
------------------------------- I am trying to
overcome this by hardcoding #Includes:
inc = Optimize ("include file",
1, 1, 100, 1);
if (inc == 1) {#include "file1.afl"} if (inc == 2)
{#include "file2.afl"} if (inc == 3) {#include "file3.afl"} ... if
(inc == 100) {#include "file100.afl"}
However, here is another problem
I discovered. #Include cashes ALL FILES on EACH optimization. That means, no
matter what #include it will use, it still cashes all files. In my case it
takes 10 seconds, to put all files into cache, when I need only one, and then
onlyu 0.2 seconds to execute! This 10 seconds is a huge loss in
performance, and it is not
neccesary.
--------------------------------- Finally, I found a very
clumsy workaround, but it is very unreliable and slow (uses hard disc
reads/writes):
1. I use fgets and fputs to write "include.afl"
file. 2. The file is included using #include "include.afl" 3. The
include.afl file is overwritten by the new formations from other files using
fgets/fputs.
I would like to ask, if anyone had the same issues? What
would you suggest to overcome this?
Many thanks in
advance, B.
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
|