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

[amibroker] Re: Using booleans to weed out useless criteria


  • Date: Sun, 03 Jan 2010 13:28:29 -0000
  • From: "progster01" <progster@xxxxxxxxxxxxxxxxxx>
  • Subject: [amibroker] Re: Using booleans to weed out useless criteria

PureBytes Links

Trading Reference Links

Rob,

I suggest you try a construction something like this:

Buy = MACD() > Signal()
AND ( ( (UseCC_LT == True) AND (CCI(period) < cc) ) or (UseCC_LT == False) )
AND ( ( (UseCC_GT == True) AND (CCI(period) > cc) ) or (UseCC_GT == False) )
;


Several key points of the above are:

1.  Each UseXXX flag is named to make it's function clear  (e.g. UseCC_LT means "use the CC less-than condition".

2.  The logic is such that when the UseXXX flag is FALSE, meaning you want to ignore that condition, the local boolean clause evaluates to TRUE.  This accomplishes ignoring the condition in a sequence of AND'd clauses.  

3.  Parenthesis are used throughout to make associations and evaluation crystal clear.  

I hope this is useful to you.  Cheers!

--- In amibroker@xxxxxxxxxxxxxxx, "bacu_robert" <bacu_robert@xxx> wrote:
>
> Hello group:
> 
> To analyze whether I have the best conditions for determining a buy, I would like to use booleans to weed out the useless crtieria, but I cannot figure out how to write it.  For the pseudo code I wrote below, I don't know if I want to be more than or less than a optimized value of CCI(period).  I know that I can manually run several tests to discover the right symbol, but I would rather take the lazy way and let the computer do the work for me, especiall when I add several criteria.
> 
> It seems so simple, but what I have written does not work.  Can someone looke this over and tell me what I am doing wrong?
> 
> 
> period = 12;
> int_cc_b = Optimize("CCI bool b",  0,   0,   1,  1 );
> cc       = Optimize("CCI",        -0,-150, 150, 20 );
> int_cc_a = Optimize("CCI bool a",  0,   0,   1,  1 );
> 
> bool_cc_a= False;
> bool_cc_b= False;
> 
> if (int_cc_a == 0) bool_cc_a = False; else bool_cc_a = True;
> if (int_cc_b == 0) bool_cc_b = False; else bool_cc_b = True;
> 
> Buy = MACD() > Signal()
>  AND (bool_cc_b AND CCI(period) < cc)
>  AND (bool_cc_a AND CCI(period) > cc)
> ;
> 
> Sell  = MACD() < Signal()
> ;
> 
> Thanks in advance,
> Rob
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/