How to log during optimization?

 

Hi, is there a way to write log files during optimization?

I would like to print stuff while multiple optimization agents are running.

Is there a way to see results of

Print("...")


commands somewhere?


Thank you very much

 
Eugen Funk: Hi, is there a way to write log files during optimization? I would like to print stuff while multiple optimization agents are running. Is there a way to see results of Print("..."). commands somewhere?

Prints() does not work during optimisation. Output your data to a file instead.

 
Fernando Carreiro #:

Prints() does not work during optimisation. Output your data to a file instead.

Thank you!

Do you have a ref to some example code to achieve this?

 
Eugen Funk #: Do you have a ref to some example code to achieve this?
It is just normal file operations ... Documentation on MQL5: File Functions
 
Eugen Funk #: Thank you! Do you have a ref to some example code to achieve this?

Please note however that Print() in the OnTester() does output to the "Experts" log, in the "Toolbox" section.

Forum on trading, automated trading systems and testing trading strategies

OnTester, OnTesterPass, OnTesterDeinit events seem not firing

Fernando Carreiro, 2021.07.08 10:11

Ok, so the Print() only outputs to the "Experts" log if it is in the OnTester???() event handlers but not if it is in the OnTick() or OnInit() handler. Strange behavior!

Thank you for explaining it!

 
Fernando Carreiro #:

Please note however that Print() in the OnTester() does output to the "Experts" log, in the "Toolbox" section.

wow this functionality was well hidden .

 
Fernando Carreiro #:

Please note however that Print() in the OnTester() does output to the "Experts" log, in the "Toolbox" section.

It also logs with visual in the tester agent window log.

 
Enrique Dangeroux #: It also logs with visual in the tester agent window log.

Your statements a little confusing!

If you are talking about the Visual Tests (single pass) then all Prints will work correctly anyway.

Or are are you referring to something else during optimisations?

 
Fernando Carreiro #:

Your statements a little confusing!

If you are talking about the Visual Tests (single pass) then all Prints will work correctly anyway.

Or are are you referring to something else during optimisations?

Yes. i forgot it was about optimization. Excuse moi.

To make a small contribution after my derail; 

OnTesterPass also does output to the "Experts" log, in the "Toolbox" section

edit, All Ontester* do.

 
Enrique Dangeroux #: Yes. i forgot it was about optimization. Excuse moi. To make a small contribution after my derail; OnTesterPass also does output to the "Experts" log, in the "Toolbox" section edit, All Ontester* do.

Actually I had already stated that ... " the OnTester???() event handlers ".

But it was still good that you pointed it out just in case it was not clear in my post. 👍