OnTesterPass() - Not Firing - Potential bug??

 

After exhaustive testing and even some chatgpt help it would seem that there is a bug with the OnTesterPass(), I'm hoping someone can shed some light or we can get this issue fixed (I'm far far from a great programmer).

I'm trying to do an optimization and store some data but it would seem that the function is not firing after each pass, im using the slow complete optimization with 1000 parameters, i've used all of my local agents and also just one single one with the same result.

I've tried minimal test ea's with some print statements and I can't get it to fire, i've also tried downloading a fresh mt5 off of the official website and to no avail sadly... here's what I have so far:


#property strict
input double MyOptimizedParam = 1.0;

void OnTesterInit()
  { Print("OnTesterInit: param= ", MyOptimizedParam); }

void OnTesterPass()
  { Print("OnTesterPass: param= ", MyOptimizedParam); }

void OnTesterDeinit()
  { Print("OnTesterDeinit: param= ", MyOptimizedParam); }

double OnTester()
  { return(MyOptimizedParam * 100.0); }

int OnInit()
  { Print("OnInit: param= ", MyOptimizedParam); return INIT_SUCCEEDED; }

void OnTick(){}


I've attached some pictures so you can see some logs and settings.

I could really use some help! lol

Files:
1.png  108 kb
2.png  69 kb
3.png  18 kb
4.png  33 kb
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Fernando Carreiro #:
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893

Ok thanks, I wasn't really sure which was better..

 

I removed my previous post because I misunderstood your question.

I have a question however, is it not the case that the OnTesterPass is only called when you use the FrameAdd functionality?

Also, the line "#property strict" is only used in MQL4. It's totally ignored in MQL5. Use it only if your code is meant to compile on both.

 

From the documentation ...

The TesterPass event is generated automatically when receiving a frame during an Expert Advisor optimization in the strategy tester.

An EA having OnTesterDeInit() or OnTesterPass() event handler is automatically downloaded on a separate terminal chart during the optimization start. It has the symbol and the period that have been specified in the tester. The function is meant for handling frames received from test agents during optimization. The frame containing test results should be sent from the OnTester() handler using the FrameAdd() function.

Keep in mind that optimization frames sent by test agents using the FrameAdd() function may come in bundles and take time to deliver. Therefore, not all frames, as well as TesterPass events, may arrive and be processed in OnTesterPass() before the end of optimization. If you want to receive all belated frames in OnTesterDeinit(), place the code block using the FrameNext() function.

After completing OnTesterDeinit() optimization, it is possible to sort all received frames again using the FrameFirst()/FrameFilter and FrameNext() functions.

Documentation on MQL5: MQL5 programs / Client Terminal Events
Documentation on MQL5: MQL5 programs / Client Terminal Events
  • www.mql5.com
Immediately after the client terminal loads a program (an Expert Advisor or custom indicator) and starts the process of initialization of global...
 
Fernando Carreiro #:

From the documentation ...

The TesterPass event is generated automatically when receiving a frame during an Expert Advisor optimization in the strategy tester.

An EA having OnTesterDeInit() or OnTesterPass() event handler is automatically downloaded on a separate terminal chart during the optimization start. It has the symbol and the period that have been specified in the tester. The function is meant for handling frames received from test agents during optimization. The frame containing test results should be sent from the OnTester() handler using the FrameAdd() function.

Keep in mind that optimization frames sent by test agents using the FrameAdd() function may come in bundles and take time to deliver. Therefore, not all frames, as well as TesterPass events, may arrive and be processed in OnTesterPass() before the end of optimization. If you want to receive all belated frames in OnTesterDeinit(), place the code block using the FrameNext() function.

After completing OnTesterDeinit() optimization, it is possible to sort all received frames again using the FrameFirst()/FrameFilter and FrameNext() functions

Fernando for the win! that worked, I can't believe I missed that. thank you sir.