It seems that MQL4 EventSetTimer is not supported for replay?!

 

I wrote a program to use timer event. I doubt that EventSetTimer is not supported for replay. Since I didn't find any discriptions in the document, I publish this topic to get confirmation.

Here are the code:

//+------------------------------------------------------------------+
//|                                                    TimerTest.mq4 |
//|                                       Copyright 2014, aforexpert. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, aforexpert."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| expert include                                                   |
//+------------------------------------------------------------------+
#include <stdlib.mqh>

//--- input parameters
input ushort   seconds=300;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   if(!EventSetTimer(seconds))
     {
      int error=GetLastError();
      PrintFormat("EventSetTimer FAILED: #%d[%s]", error, ErrorDescription(error));
     }
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   Print("OnTimer");
  }
//+------------------------------------------------------------------+

No compliing error(s) or warning(s).

Then I replay it in Strategy Tester. Settings below:

 

It gives the following error: “2014.09.06 10:26:26.023 2014.09.01 00:00 TimerTest EURUSD,M1: EventSetTimer FAILED: #4051[invalid function parameter value]”

But when I load it to a live demo chart, the above error disappears:

 

 

The back tester does not work with OnTimer() events.

If you want to process data in the back tester, I would advise using the OnTick() function instead.


 
smarterai:

The back tester does not work with OnTimer() events.

If you want to process data in the back tester, I would advise using the OnTick() function instead.


Confirmed, thank you!
 
aforexpert:
Confirmed, thank you!

hi, i want to use OnTimerEvent in my program and run my expert every 15 minutes...till now i don't have any problem..

my problem is that i want to set for example start from minute 5 and calculate...

for example i want to set the base minute 5 and expert run every 15 minutes e.g. in minutes 20, 35, 50...

i wonder if someone cn help me..... 

Reason: