Download MetaTrader 5

Stop running EA on invalid inputs (Especialy on tester)

To add comments, please log in or register
Chronis Boulanikis
2550
Chronis Boulanikis  

Hello.

How can i stop ea (don't lose time for testing) if an invalid input has placed???

Example: I use (for testing) for a macd a range of fastema 8-18 and for slowema 14-24. I don't want test the combinations that fastema>=slowema (14-14, 16-14, 18-14, 16-16, 16-18, 18-18).

I think place [OnInit] an "if (fastema>=slowema)" but i don't know what it must do then!!!!

Thanks.

Alain Verleyen
Moderator
32848
Alain Verleyen  
chronisb:

Hello.

How can i stop ea (don't lose time for testing) if an invalid input has placed???

Example: I use (for testing) for a macd a range of fastema 8-18 and for slowema 14-24. I don't want test the combinations that fastema>=slowema (14-14, 16-14, 18-14, 16-16, 16-18, 18-18).

I think place [OnInit] an "if (fastema>=slowema)" but i don't know what it must do then!!!!

Thanks.

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

if (fastema>=slowema)
   return(INIT_PARAMETERS_INCORRECT);
Chronis Boulanikis
2550
Chronis Boulanikis  

Thank you very much.

To add comments, please log in or register