CopyTicks & error 4014

Hi,

To gather ticks infos, I use the code provided by mql5 with the strategy tester on EURUSD, M1, quality 100% :slight_smile:

/--- the array that receives ticks
   MqlTick tick_array[];
//--- requesting ticks
   int copied=CopyTicks(_Symbol,tick_array,COPY_TICKS_ALL,0,ticks);
//--- if ticks are received, show the Bid and Ask values on the chart  
   if(copied>0)
     {
      string comment="#  Time       Bid        Ask\r\n";
      //--- generate the comment contents      
      for(int i=0;i<copied;i++)
        {
         MqlTick tick=tick_array[i];
         string tick_string=StringFormat("%d: %s  %G  %G",
                                         i,
                                         TimeToString(tick.time,TIME_MINUTES|TIME_SECONDS),
                                         tick.bid,
                                         tick.ask);
         comment=comment+tick_string+"\r\n";
        }
        //--- show a comment on the chart        
        Comment(comment);
     }
   else // report an error that occurred when receiving ticks
     {
      Comment("Ticks could not be loaded. GetLastError()=",GetLastError());
     }
  }

And that’s simply the error I’m getting :

2016.02.25 11:23:44.434 2016.02.01 09:24:09   Ticks could not be loaded. GetLastError()= 4014

Anyone to help there ?

What is the total number of variables ticks?

//--- requesting ticks
   int copied=CopyTicks(_Symbol,tick_array,COPY_TICKS_ALL,0,ticks); // int ticks=?

CopyTicks() doesn’t work in the Strategy Tester. Anyway it doesn’t make sense to use it with the Strategy Tester.

icortenb, please explain, why CopyTicks() doesn’t work on the Strategy Tester?

I use 5 for tests…

Is there any alternative if you wish to work with ticks ?

Work with ticks in the Strategy Tester ? There is no missed ticks there so CopyTicks is useless. If you want to work with ticks the Strategy Tester is useless, it’s not real ticks but calculated ones.

The “alternative” is to work on live chart or eventually record the ticks yourself.

Place Real Ticks in execution mode. It will do.