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

RE: [amibroker] Conditional include



PureBytes Links

Trading Reference Links

My last post on this:
 
That is one confoosing thread.  The bottom line seems to be (from TJ):
 
Since #include is pre-processor command, files are included
BEFORE execution, so both files are included anyway.
Later on appropriate part (depending on condition) is executed.
Also since included files may contain more than one line you should use
{ } braces:

if(Choice==1)
{
#include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long afl.afl"
}
else
{
#include "D:\Program Files\AmiBroker\Formulas\Custom\Rem_Long afl_Var.afl"
}

Also since #include is pre-processor command and not a statement so semicolon is not needed

d

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Terry
Sent: Tuesday, September 06, 2005 10:48 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Conditional include

I would like to conditionally load and execute an Include file only on days when certain conditions are True. I do this with ParamToggle all the time since ParamToggle creates a numeric or Boolean condition. Now I want to do it only on days when I have a Buy or Sell condition which is in an array and Amibroker complains that array is not allowed in an if() statement. IIf is not acceptable since it is just an assignment statement. I don’t want to build a loop since the include file uses arrays.

 

Here’s the code. Any ideas?

 

 

    if (newBuy OR newSell)

        #include <W_Xfactor.afl>

    else

        tradeLevel = trange = 1;

 

Error 6. Condition in IF, WHITEL, FOR statements ahs to be Numeric or Boolean type. You can not use array here, please use [] (array subscript operator) to access array elements.

--

Terry

 



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