Download MetaTrader 5

How to have optimization-parameters depending on each other for Strategy Tester in MQL5?

To add comments, please log in or register
Taademi
9
Taademi  

Hi there!

Sry if the subject doesn't quite tickle the point of my question, maybe bad wording within this post and if my question already got answered elsewhere. I've searched for it.

Problem:

Let's say your expert advisor works with some kind of related parameters such as two Moving Averages and a crossover signal of those. This way, you might want one of both MAs to always have a lower period than the other one.

Now you set up your parameters for optimization through the strategy tester like this:

MA1-period, start: 5, step: 1, stop: 50      //(the "fast" one)

MA2-period, start: 6, step: 1, stop: 100    //(the "slow" one)

Is there a way to avoid the tester to run tests on settings where the MA2-period is lower than the MA1-period?

I've done some research on the OnTester..(), aswell as the Frame...() and ParameterSetRange() functions, but to be honest, they arn't quite as good explained as other topics.

I would even be satisfied, if i just could tell the strategy tester to skip the pass if the conditions arn't met.

Thank you in advance.

Taademi

Alain Verleyen
Moderator
33271
Alain Verleyen  

Forum on trading, automated trading systems and testing trading strategies

Stop running EA on invalid inputs (Especialy on tester)

Alain Verleyen, 2013.11.23 16:57

Place your test in OnInit() and return INIT_FAILED or INIT_PARAMETERS_INCORRECT. Like :

if (fastema>=slowema)
   return(INIT_PARAMETERS_INCORRECT);

Taademi
9
Taademi  

Ah!

That's smart!

Thank you very much!

To add comments, please log in or register