I noticed the OnDeinit will be called, it's just the Print output that goes into the waste bin. Strange enough this happens only when OnInit passes, and when I add OnTester the Print output from OnDeinit is absent in any case.
Sorry if this was disturbing to any one. I'll leave it here for comments.
I noticed the OnDeinit will be called, it's just the Print output that goes into the waste bin. Strange enough this happens only when OnInit passes, and when I add OnTester the Print output from OnDeinit is absent in any case.
Sorry if this was disturbing to any one. I'll leave it here for comments.
I was disturbed :-D
I knew the print was disabled during an optimization, so I was surprised you got some output when OnInit failed. Interesting to know.
I was disturbed :-D
I knew the print was disabled during an optimization, so I was surprised you got some output when OnInit failed. Interesting to know.
ok, sorry... I had some deallocation going wrong and was misled by this ouput.
2190 logs OnDeinit output (but only on fail), some prior builds do not log OnDeinit output at all - during optimization. Normal tests log
everything.
ok, sorry... I had some deallocation going wrong and was misled by this ouput.
2190 logs OnDeinit output (but only on fail), some prior builds do not log OnDeinit output at all - during optimization. Normal tests
log everything.
No need to be sorry, it was useful :-) We learnt something.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It looks like during optimization the tester agent does only call OnDeinit when the OnInit fails. If it passes, OnDeinit will not be called.
I have no idea why.
Sample EA to reproduce:
An optimization run with Start=(1,2) Stop=(1,2,3) yields this print output:
MQL5 documentation says about Deinit event:
"Before global variables are deinitialized and the program (Expert Advisor or custom indicator) is unloaded, the client terminal sends the Deinit event to the program. Deinit is also generated when the client terminal is closed, when a chart is closed, right before the security and/or timeframe is changed, at a successful program re-compilation, when input parameters are changed, and when account is changed."
"Deinit event is generated for EAs and indicators in the following cases:
It's fairly obvious that the input parameters change on every pass, so why do I get a Deinit in only 3 of 6 passes?