During optimisations, Print() or PrintFormat() does not have any effect or output anything. Only during single test runs do they output to the log.
That's not totally exact. They can output in the terminal Experts log (not the one from the Strategy Tester).
@Alain: In my case there is no output to the terminal Experts log (the tab is called "Journal" in the German version) during or after optimization. Or do you mean another tab?
I can confirm Fernandos statement: I don't see anything printed from the OnTester event.
OnTester event: As an alternative of printing I insert the information I need to a sqlite database. This works perfect.
Settings: Custom Symbol
They do? I've never seen that happen before!
EDIT: Ran a quick test and nothing was printed to the "Experts" or "Journal" log in the "Toolbox" section. Is there some option to enable this?
EDIT2: As per the official documentation notes:
Print() function does not work during optimization in the Strategy Tester.PrintFormat() function does not work during optimization in the Strategy Tester.
- www.mql5.com
@Alain Verleyen is referring the "Experts" log, in the "Toolbox" section, not the "Strategy Tester" section. However, I have never seen that happen either. Maybe he can provide more details of when that can happen.
Exactly.
void OnTesterInit() { Print("Begin..."); } //+------------------------------------------------------------------+ void OnTesterPass() { ulong pass=0; string name=""; long id=0; double value=0.0; double data[]; while(FrameNext(pass,name,id,value,data)) { Print(pass," ",name," ",id," ",value); } } //+------------------------------------------------------------------+ void OnTesterDeinit() { Print("... end."); }
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!
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!
It's not strange, it's just Metaquotes way and mainly undocumented. It's like 2 EAs in one, you are just not accustomed yet with the concept.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm trying to use the OnTester events, but it seems to me that they don't fire.
Code for testing:
After finishing the optimization I check the journal but there is nothing printed from the events:
Can you please give me a tip? I don't know what I'm doing wrong.
Best regards
Jorg