Maybe something like this?
#define OSMA_DEFAULT_F 120 #define OSMA_DEFAULT_S 70 #define OSMA_DEFAULT_SIG 45 input bool use_osma= true; input int fOs = OSMA_DEFAULT_F; input int sOs = OSMA_DEFAULT_S; input int sigOs = OSMA_DEFAULT_SIG; int OnInit() { bool osma_skip = (!use_osma && (fOs != OSMA_DEFAULT_F || sOs != OSMA_DEFAULT_S || sigOs != OSMA_DEFAULT_SIG ) ); if(osma_skip) return INIT_PARAMETERS_INCORRECT; return INIT_SUCCEEDED; }
Hello,
I have a strategy in which I have a few filters I am using, namely OsMA, Stochastic, RSI and CCI. Apart from the parameters of each indicator, I have on and off inputs for each one of them:
Now when I'm trying to optimise the strategy, I want to also check which combination of filters works best. But the problem is that when one of the filters is turned off( let's say for example it's the OsMA that is off), the optimisation still does tests with different settings for the OsMA, wasting unnecessary testing time.
So is there a way to skip these different tests of an indicator's settings, when that indicator is turned off?
I can't think of a way to do it with INIT_PARAMETERS_INCORRECT.
Thanks
The approach proposed by nicholishen will certainly work in theory.
However please note if you want to use the Genetic algorithm, that you can't reject too much parameters this way as it will screw up the algorithm (according to Metaquotes).
The approach proposed by nicholishen will certainly work in theory.
However please note if you want to use the Genetic algorithm, that you can't reject too much parameters this way as it will screw up the algorithm (according to Metaquotes).
Excellent point.
Agree. I use ExpertRemove() onInit for incompatible parameters, optimizer runs no problem with the rest.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have a strategy in which I have a few filters I am using, namely OsMA, Stochastic, RSI and CCI. Apart from the parameters of each indicator, I have on and off inputs for each one of them:
Now when I'm trying to optimise the strategy, I want to also check which combination of filters works best. But the problem is that when one of the filters is turned off( let's say for example it's the OsMA that is off), the optimisation still does tests with different settings for the OsMA, wasting unnecessary testing time.
So is there a way to skip these different tests of an indicator's settings, when that indicator is turned off?
I can't think of a way to do it with INIT_PARAMETERS_INCORRECT.
Thanks