Using Timer in strategy tester

 

I'm trying to test my EA in the strategy tester, but when I set the EventSetTimer I get an error - 4051 (ERR_INVALID_FUNCTION_PARAMVALUE).

When I put the same EA on a chart (instead of the strategy tester) , I don't get this error.

I created a new EA with only a simple print in the OnTimer() and I get the same error:

int OnInit()
{
   //--- create timer
   bool rt = EventSetTimer(60);
   if(!rt)
   {
      Print("Error GetLastError() = ", GetLastError() ) ;
   }   

   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
   //--- destroy timer
   EventKillTimer();
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{

}

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
{
   Print("--------Timer-----------") ;
}

 

Is there a different way I should use the timer in the strategy tester?
 
sa1221:

I'm trying to test my EA in the strategy tester, but when I set the EventSetTimer I get an error - 4051 (ERR_INVALID_FUNCTION_PARAMVALUE).

When I put the same EA on a chart (instead of the strategy tester) , I don't get this error.

I created a new EA with only a simple print in the OnTimer() and I get the same error:

 

Is there a different way I should use the timer in the strategy tester?

Did you ever use the Forum Search facility ?

 

https://www.mql5.com/en/forum/149813 

 
Thanks