Change your parameters and code a bit.
Indicator A: bool enabledA = true|false int periodA = 0-200 indicator B: bool enabledB = true|false int periodB = 0-200
If the periodX is 0, then disable the indicator in your code.
Change your parameters and code a bit.
If the periodX is 0, then disable the indicator in your code.
I'm already doing that, but I think I'm not explaining this correctly.
At optimisation boot time, all the possible pass combinations are created in a map. This leads to duplicate passes:

So even though, there really should only be 1 pass generated and run, it's running the same pass 4 times, getting the same result 4 times. This is wasteful.
So even though the indicator is disabled, it still will run a pass with those parameters, even though it has no impact on the outcome.
So currently, the complete/genetic optimisation will generate 160,000 passes, when in reality, it should only be 40,401.I'm already doing that, but I think I'm not explaining this correctly.
At optimisation boot time, all the possible pass combinations are created in a map. This leads to duplicate passes:
So even though, there really should only be 1 pass generated and run, it's running the same pass 4 times, getting the same result 4 times. This is wasteful.
So even though the indicator is disabled, it still will run a pass with those parameters, even though it has no impact on the outcome.
So currently, the complete/genetic optimisation will generate 160,000 passes, when in reality, it should only be 40,401.No you are not doing that, you are over complicating things.
I provided you the solution. 2 parameters with 201 combinations is 40401.
No you are not doing that, you are over complicating things.
I provided you the solution. 2 parameters with 201 combinations is 40401.
Then either code within the EA an indexed lookup table to filter out the unwanted combinations, and/or use the faster genetic optimisation to narrow down which combinations are a better fit.
That's what I'm looking for. But the problem is that the optimisation passes are done at startup, so you can get potentially billions of passes that shouldn't be run. I would love to find a way to filter out/update the bad passes before the testing starts. it's not a case of the lookup table to filter out unwanted combinations, it's a problem where duplicated results are returned for multiple passes when the critreria for the pass shouldn't be considered. I get that you are trying to help, and I've tried all the avenues that I can think of. if i could find a way to read in a lookup table with the combinations, then that would be ideal. But the current functionality of the ParameterSetRange, does not allow that. Unless there's another method i can use to manually set the parameters i want to test.
I think this usecase falls outside the current capability of metatrader. Let me be clear, i'm not saying Metatrader is bad, it's just this usecase, where I want to remove the ability for the optimising parameters to be running passes when it's going to have no material impact on the results, is missing.
That's what I'm looking for. But the problem is that the optimisation passes are done at startup, so you can get potentially billions of passes that shouldn't be run. I would love to find a way to filter out/update the bad passes before the testing starts. it's not a case of the lookup table to filter out unwanted combinations, it's a problem where duplicated results are returned for multiple passes when the critreria for the pass shouldn't be considered. I get that you are trying to help, and I've tried all the avenues that I can think of. if i could find a way to read in a lookup table with the combinations, then that would be ideal. But the current functionality of the ParameterSetRange, does not allow that. Unless there's another method i can use to manually set the parameters i want to test.
I think this usecase falls outside the current capability of metatrader. Let me be clear, i'm not saying Metatrader is bad, it's just this usecase, where I want to remove the ability for the optimising parameters to be running passes when it's going to have no material impact on the results, is missing.
As @Alain Verleyen stated, you are overcomplicating something which is quite simple.
Create a table of all the possible combinations you want, discarding the ones you don't want. Then simply have a single parameter which is the index to that table.
For example, use a single parameter "i_nIndex" which could range from 0 to 3 in your optimisation, and internally in your EA, use that as an index for the individual parameters saved in an array of a structure with predefined initialised data.
input int i_nIndex = 0; // Table Index
EDIT: If you have a lot of combinations, generate the table data separately and then include it as a header file on the main EA code file.
Index (parameter) MA1 period (internal) MA2 period (internal) RSI period (internal) 0 10 20 14 1 10 50 28 2 20 100 14 3 20 200 28

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi here.
I've been looking for information on how to implement conditional genetic/complete optimisation. The closest I could get was to use ParameterSetRange, however this does not satisfy my criteria.
So let's assume in my EA, I've got a section for 2 indicators:
Indicator A:
bool enabledA = true|false
int periodA = 1-200
indicator B:
bool enabledB = true|false
int periodB = 1-200
So what I'm trying to achieve is that in the optimisation section, I select the checkbox for the enabledment of the indicators as well as the periods. As you can imagine that's an insane amount of tests to run. What I do want, is to say if enabledA is false, then don't even create parameters for periodA and the same for enabledB. I can validate that enabledA and enabledB cannot both be false in the OnInit function, but the problem lies when the parameters are created.
From my understanding, ParameterSetRange is basically just a programmatic way of setting the optimisation parameters, and it has to be "generated" at OnTestInit. This doesn't work, because:
1. The parameters are generated at boot time
2. Even if enabledA is false, the new pass hash would still be new because the periodA might be different.
If this feature does not exist, could it be added as a feature request? It would make running optmisations much more efficient.
Thanks