# Switch boolan operator in backtest mode

Hello everyone,

I want to backtest my code with the strategy tester but i want an external input that say sometimes it's "&&" sometimes it's "||", is it possible ?

Example :

External_Input_1 between 1 and 10 (in the strategy tester)

External_Input_2 between 1 and 10 (in the strategy tester)

External_Input_3 between 1 and 10 (in the strategy tester)

I want to test all combination of external input BUT i also want all combinaision with || instead of && :

```if (MyVar_1==External_Input_1 &&/|| MyVar_2==External_Input_2 &&/|| MyVar_3==External_Input_3)
{
}
```

What do you think will happen when you switch AND and OR?
If you are not sure, search for logical operators in the reference.

Tobias Johannes Zimmer #:
What do you think will happen when you switch AND and OR?
If you are not sure, search for logical operators in the reference.

I think you don't understand my request. I exactly know what logical operator do ...

I want that my tester change automatically my input with all combination with "and and "or" (above is a simple example)

Exactly the same way as the tester can test all combinations for input betwwen 1 and 10 for example.

Hugh:

Hello everyone,

I want to backtest my code with the strategy tester but i want an external input that say sometimes it's "&&" sometimes it's "||", is it possible ?

Example :

External_Input_1 between 1 and 10 (in the strategy tester)

External_Input_2 between 1 and 10 (in the strategy tester)

External_Input_3 between 1 and 10 (in the strategy tester)

I want to test all combination of external input BUT i also want all combinaision with || instead of && :

Just use a bool input to switch between two different functions for 'and'  'or'

Paul Anscombe #:
Just use a bool input to switch between two different functions for 'and'  'or'

Imagine there is 1000 possible combinations... i will not switch manually to test everything.. that's my point i want to use the strategy tester for that.

With just this tiny example i have 4 combinations :

`if (MyVar_1==External_Input_1 && MyVar_2==External_Input_2 && MyVar_3==External_Input_3)`
`if (MyVar_1==External_Input_1 || MyVar_2==External_Input_2 || MyVar_3==External_Input_3)`
`if (MyVar_1==External_Input_1 && MyVar_2==External_Input_2 || MyVar_3==External_Input_3)`
`if (MyVar_1==External_Input_1 || MyVar_2==External_Input_2 && MyVar_3==External_Input_3)`

In my Code is many more than 4...

Thank you

Hugh #: Imagine there is 1000 possible combinations... i will not switch manually to test everything.. that's my point i want to use the strategy tester for that. With just this tiny example i have 4 combinations : In my Code is many more than 4...

I think that you should rethink and refactor your "logic" for the your code. Break it down and simplify it in logical repeatable terms. Then using arrays of the data (instead of individual variables), you can iterate over it (using loops), to get a final result of the calculations.

Alternatively, externally produce a file of all the combinations of input parameter values you want to test and then feed that to the optimisations via a single "Line Index" input parameter to the EA being tested. The EA would then read the parameters from that "Line Index" of the file and use those input parameters for the back-test.
Reason: