Download MetaTrader 5

EventSetTimer and the Backtest speed

To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
Henrique Vilela
1231
Henrique Vilela 2015.10.12 21:44 

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
4684
Marco vd Heijden 2015.10.12 22:35  
//+------------------------------------------------------------------+
//| 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
1231
Henrique Vilela 2015.10.18 14:37  
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