Download MetaTrader 5
To add comments, please log in or register
Share links from other resources. Now they have a description.
Scarlett
34
Scarlett 2014.08.04 16:46 

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?
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.08.04 19:05  
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 

Scarlett
34
Scarlett 2014.08.05 13:49  
Thanks
/
To add comments, please log in or register