Skipping some input in strategy

 

Hi to all,

I want to test an EA but depending of the value of an input, some other inputs should not be considered.
How can I do that?
I created a static list, and put a key to track the input tested but it seems this approach is not working.

Maybe a better approach exists, any idea?
Thanks

 
Marco Montemari: I want to test an EA but depending of the value of an input, some other inputs should not be considered. How can I do that? I created a static list, and put a key to track the input tested but it seems this approach is not working. Maybe a better approach exists, any idea?

In the OnInit() event handler, test for the valid combination of parameters and if they are not valid, return the "INIT_PARAMETERS_INCORRECT" result.

The optimiser will then proceed on to the next iteration of the process and set all the results for that pass to zeros.

EDIT: You can also set special combinations that are only valid (or not valid) when running under the optimiser. Verify this condition with "MQL_OPTIMIZATION".

 
  1. You do exactly that, ignore the other inputs. If(input) condition=…(); else condition=…(other inputs);
  2. Static list of what? That makes no sense.
  3. Until you can state your requirements in concrete terms, it can not be coded. No recommendations can be given.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

 
William Roeder #:
  1. You do exactly that, ignore the other inputs. If(input) condition=…(); else condition=…(other inputs);
  2. Static list of what? That makes no sense.
  3. Until you can state your requirements in concrete terms, it can not be coded. No recommendations can be given.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem


ok.
I have some inputs:

input int SL;

input int TP;

then I have also these:

input bool TrailingEnabled;

input int Activation;

input int Trailing;

input bool TrailingFollowing;


The tester will try all the possibile combinations BUT, if the TrailingEnabled is false, the tester can skip all the combinations related to the trailing.
I hope is more clear now

 
Marco Montemari #: The tester will try all the possibile combinations BUT, if the TrailingEnabled is false, the tester can skip all the combinations related to the trailing. I hope is more clear now

I have already given you the answer — use "INIT_PARAMETERS_INCORRECT" in combination with detecting if it is under optimisations.

Forum on trading, automated trading systems and testing trading strategies

Skipping some input in strategy

Fernando Carreiro, 2022.10.03 15:25

In the OnInit() event handler, test for the valid combination of parameters and if they are not valid, return the "INIT_PARAMETERS_INCORRECT" result.

The optimiser will then proceed on to the next iteration of the process and set all the results for that pass to zeros.

EDIT: You can also set special combinations that are only valid (or not valid) when running under the optimiser. Verify this condition with "MQL_OPTIMIZATION".

 
Fernando Carreiro #:

I have already given you the answer — use "INIT_PARAMETERS_INCORRECT" in combination with detecting if it is under optimisations.

I was replying to William. How can I decide if they are valid? I mean:
let suppose the tests are these:

1) A,B,TrailingOn, TrailingAct=3,TrailingStep=1
2) S,B,TrailingOFF, TrailingAct=4,TrailingStep=2

3) S,B,TrailingOFF, TrailingAct=5,TrailingStep=2

4) S,B,TrailingOFF, TrailingAct=6,TrailingStep=2

testing 1 and 2 is ok, but 3 and 4 and other similar no and I wanna skip there because the result will be exactly the same as point 2.
That is why if Trailing is off, I store in a static list the values of A and b ( or S and B) to skip the test returning Parmeters incorrect, but seems not working

 
Marco Montemari #: How can I decide if they are valid? I mean: let suppose the tests are these:


1) A,B,TrailingOn, TrailingAct=3,TrailingStep=1
2) S,B,TrailingOFF, TrailingAct=4,TrailingStep=2
3) S,B,TrailingOFF,
 TrailingAct=5,TrailingStep=2
4) S,B,TrailingOFF,
 TrailingAct=6,TrailingStep=2

testing 1 and 2 is ok, but 3 and 4 and other similar no and I wanna skip there because the result will be exactly the same as point 2. That is why if Trailing is off, I store in a static list the values of A and b ( or S and B) to skip the test returning Parmeters incorrect, but seems not working

You have just answered you own question. If you say that 1 or 2 are valid, but not 3 nor 4, then that is what you report with the result "INIT_PARAMETERS_INCORRECT".

 
Fernando Carreiro #:

You have just answered you own question. If you say that 1 or 2 are valid, but not 3 nor 4, then that is what you report with the result "INIT_PARAMETERS_INCORRECT".

I dunno which values the stretgy tester will put

 
Marco Montemari #:I dunno which values the stretgy tester will put

Yes, you do! You read the values set for the "inputs". Don't you already do that to decide what behaviour the EA should take?

 

Here is an example from the CodeBase ... Have a look at the OnInit() handler ...

Code Base

MARE5.1

Vladimir Karputov, 2017.03.02 11:50

The MARE5.1 Expert Advisor is very easy to use. It uses the values of two Moving Averages (SMA) at the close of 0th, 2nd and 5th bar. The EA is configured to work on the M1 timeframe.
 
Fernando Carreiro #:

Here is an example from the CodeBase ... Have a look at the OnInit() handler ...

I have read, but my case is different.
my input:
A,B,C,D,E
if C=0 I do not care of D ed E but at least once the combination should be calculated.
Example
1,1,1,1,1->ok calculate considerring all parmeters
1,1,0,1,1-> ok calculate because i need to have 1,1,0
1,1,0,1,2->as said c=0  and it has already calulcated for input 1,1,0 so skip this

1,1,0,8,4->as said c=0  and it has already calulcated for input 1,1,0 so skip this
1,2,0,1,2->ok calculate  because i need to have 1,2,0

input are in a range, there is not threshold like if time is > 10 pm return -1


Reason: