Download MetaTrader 5

EventSetTimer and the Backtest speed

To add comments, please log in or register
Henrique Vilela
1459
Henrique Vilela  

Hi,

When I use the EventSetTimer in any EA that uses an indicator the time required to do a backtest is highly increased even if the OnTimer event function is empty.

If the EA uses no indicador I feel no difference and It 's specially noticed when the indicador has heavy calculations.

Looks like the OnTimer forces the indicators to recalculate even if no new tick occurs.

This is a bug or a feature? Or am I doing something wrong? 

Marco vd Heijden
Moderator
5342
Marco vd Heijden  
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---> check for tester
   if(MQLInfoInteger(MQL_TESTER)==0)
     {
//--- if not tester, create timer
      EventSetTimer(5);
     }
//--->
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
Henrique Vilela
1459
Henrique Vilela  
Marco vd Heijden:

Thank you, but I need the timer on the backtest, that's not what I'm looking for.

I'm trying to understand why a timer set on the EA to an empty function is forcing the indicator to recalculate.

To add comments, please log in or register