choose beetween "&&" or "||" via boolean input

 

Hi,

I'm not sure I'm able to explain:

I'm trying to do some tests and I need to choose beetween && and || operator fore some conditions.

For example: which do give best result beetwen:

- if ( (condition1)&&(condition2) ) {  ordersend...}

- if ( (condition 1) || (condition2) ) {  ordersend... }


Is there any way tu put the operator into a boolean input, so that the user can choose beetwen && or ||, and try an optimization?

Otherwise is it possibile ti "print" mql code ad in PHP, so that you could put the oeprator into a viaribale and print its value according to user input?


Hope have explained in my bad english...thanks!!!

Max

 
distress:

Hi,

I'm not sure I'm able to explain:

I'm trying to do some tests and I need to choose beetween && and || operator fore some conditions.

For example: which do give best result beetwen:

- if ( (condition1)&&(condition2) ) {  ordersend...}

- if ( (condition 1) || (condition2) ) {  ordersend... }


Is there any way tu put the operator into a boolean input, so that the user can choose beetwen && or ||, and try an optimization?

So what, just do it.

input bool  make_your_choice   = true;  // true => && , false => ||

if(make_your_choice){
  if ( (condition1)&&(condition2) ) {  ordersend...}
}
else {
  if ( (condition 1) || (condition2) ) {  ordersend... } 
}


Otherwise is it possibile ti "print" mql code ad in PHP, so that you could put the oeprator into a viaribale and print its value according to user input?

No.
 
enum Test { EitherCondition, BothConditions };
input Test test = EitherCondition;
:
if( test == BothConditions
    ? (condition1 && condition2)
    : (condition1 || condition2)
   ) {  ordersend... } 
Reason: