Optimization back testing stops because of too many failures

 

Hi Guys,

Thanks for your time to help!

I wrote my EA to have ALLOT of optimization parameters and tried my best to us the initialization codes to return error codes if the optimization parameters doesn't make sense, thus trying to reduce the time spent in optimization for scenarios that just doesn't make sense. An example of such is when your slow MA period is lower than your fast MA. The code just throws a INIT_PARAMETERS_INCORRECT or INIT_FAILED (depending on the parameter scenario) in the OnInit hoping the the backtester would throw the test out and not waist time on it BECAUSE I HAVE ALLOT OF PARAMETERS.

However when the tester starts it seems there is threshold it has for iterations that fails initialization and then it stops and the testers dont continue trying the rest ASSUMING the bot is faulty? Any advice on what am doing wrong?

Speed Up Calculations with the MQL5 Cloud Network
Speed Up Calculations with the MQL5 Cloud Network
  • www.mql5.com
How many cores do you have on your home computer? How many computers can you use to optimize a trading strategy? We show here how to use the MQL5 Cloud Network to accelerate calculations by receiving the computing power across the globe with the click of a mouse. The phrase "Time is money" becomes even more topical with each passing year, and we cannot afford to wait for important computations for tens of hours or even days.
 
Ernie Gunning: INIT_PARAMETERS_INCORRECT or INIT_FAILED … ASSUMING the bot is faulty? Any advice on what am doing wrong?

You told the tester that the bot is faulty (INIT_FAILED).

 
William Roeder:

You told the tester that the bot is faulty (INIT_FAILED).

Thank you!

It seems I need to use INIT_FAILED rather than INIT_PARAMETERS_INCORRECT?


I replaced all INIT_PARAMETERS_INCORRECT to INIT_FAILED and then I got a different behavior but still not running all tests. I will respond to the forum if INIT_FAILED worked. I just want to try and use TesterStop() where possible.

The new error was a few of these and the a stop : 2021.01.04 21:36:08.816 Core 26 genetic pass (0, 387) tested with error "incorrect input parameters" in 0:00:00.001


https://www.mql5.com/en/docs/event_handlers/oninit

Using OnInit() returning INIT_FAILED/INIT_PARAMETERS_INCORRECT in the tester have some peculiarities that should be considered when optimizing EAs:

  • the set of parameters the OnInit() returned INIT_PARAMETERS_INCORRECT for is considered unsuitable for testing and is not used to obtain the next population during genetic optimization. Too many "discarded" parameter sets may lead to incorrect results when searching for optimal EA parameters. The search algorithm assumes that the optimization criterion function is smooth and has no gaps on the entire multitude of input parameters.
  • if OnInit() returns INIT_FAILED, this means that a test cannot be launched, and the EA is unloaded from the agent's memory. The EA is loaded again to perform the next pass with a new set of parameters. Launching the next optimization pass takes much more time as compared to calling TesterStop().
Documentation on MQL5: Event Handling / OnInit
Documentation on MQL5: Event Handling / OnInit
  • www.mql5.com
OnInit - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Ernie Gunning: It seems I need to use INIT_FAILED rather than INIT_PARAMETERS_INCORRECT?

What part of “you told the tester that the bot is faulty (INIT_FAILED)” was unclear?

 
William Roeder:

What part of “you told the tester that the bot is faulty (INIT_FAILED)” was unclear?

Toxicity is a choice and respect is earned.  If you enjoy speaking down on people then go buy a new personality.

What it seems you might have missed from my post is that I'm trying to let the tester NOT STOP and continue to the next optimation task. It still happened after I used both INIT_FAILED or INIT_PARAMETER_INCORRECT. Is there a way to tell the tester that he should go to the next test?


This is the error is similar for both INIT_FAILED and INIT_PARAMETER_INCORRECT

2021.01.05 09:01:59.820 Core 28 genetic pass (0, 450) tested with error "OnInit returned non-zero code 1" in 0:00:00.001

2021.01.05 09:01:59.820 Tester Best result 0.00 produced at generation 0. Next generation 1

2021.01.05 09:01:59.820 Tester 512 passes of 512 failed, genetic optimization stopped at generation 0