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

RE: [amibroker] Conditional include



PureBytes Links

Trading Reference Links

Thanks d.

 

I don’t care if it’s actually included or not. The code in question is very compute intensive and I only need the results on Buy or Sell so I just want to avoid the EXECUTION of that code when not necessary.

 

My problem is still getting the code to NOT execute UNLESS there is a newBuy or newSell, which are ARRAY conditions. So, the error is in the if(newBuy or newSell) line of code. It seems like there should be a way to “trick” AB into letting me do this.

--

Terry

-----Original Message-----
From:
amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of dingo
Sent: Tuesday, September 06, 2005 09:12
To:
amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Conditional include

 

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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS