Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

• ## Welcome Guests

Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

# AND OR Optimization in Amibroker

## Recommended Posts

Is it possible to use AND and OR for optimization in Amibroker? Lets look at this line of code:

U = Optimize(1, 0, 1, 1);

Buy = (C > MA(C,20) ) == U;  //condition is True if U = 1 and False if U = 0

In effect I can flip ">" operator to "<=" by using numerical values of 0 for False and 1 for True in optimization. Is there a way to do the same with AND and OR?

Lets look at this line of code:

Buy = ROC(C,5) > 1 OR ROC(C,1) < -2;

and this one:

Buy = ROC(C,5) > 1 AND ROC(C,1) < -2;

Is there a way to run an optimization on the following so it is an equivalent to switching between AND and OR:

OPERATOR = Optimize(AND, AND, OR, ?);

Buy = ROC(C,5) > 1 OPERATOR ROC(C,1) < -2;

Any help would be greatly appreciated.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• 0
• 102
• 0
• 2
• 0