CopyTicks help

 

This code gives error: Ticks could not be loaded. GetLastError()=4014

I don't know why.

input int      ticks=10;  // the number of requested ticks 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
   {
//--- the array that receives ticks 
   MqlTick tick_array[];
    
//--- requesting ticks 
   int copied=CopyTicks(_Symbol,tick_array,COPY_TICKS_ALL,0,ticks); 
   
      if(copied>0)
      {
      Print(" good job");
      }
      else
      {
      Print("Ticks could not be loaded. GetLastError()=",GetLastError());
      }
   }  

 


 

I tried your code on my computer and it worked fine.

 

 

The 4014 error stands for "ERR_FUNCTION_NOT_ALLOWED - System function is not allowed to call". Cannot figure out why is that :(

 
theDUDE:

This code gives error: Ticks could not be loaded. GetLastError()=4014

I don't know why.

 

Which MT5 build ?
 

Version: 5.00 build 1210

Ran it again today, still getting the error.

Here are the settings I am using in my strategy tester. 

settings 

 

Journal:

journal 

 
Jian Chen:

I tried your code on my computer and it worked fine.

 

 

The 4014 error stands for "ERR_FUNCTION_NOT_ALLOWED - System function is not allowed to call". Cannot figure out why is that :(

I have no idea either, the Code Base doesn't really have much info in terms of troubleshooting. 

 

When I was testing your code, I simply attached it on the chart and check the Expert's journal. It worked fine.

I just tested in the Strategy tester, it didn't work either. (Either "1 minute OHLC" mode or "Every tick" mode). The error code is also 4014. Maybe it's the limitation of the strategy tester. 

 
Jian Chen:

When I was testing your code, I simply attached it on the chart and check the Expert's journal. It worked fine.

I just tested in the Strategy tester, it didn't work either. (Either "1 minute OHLC" mode or "Every tick" mode). The error code is also 4014. Maybe it's the limitation of the strategy tester. 

Not maybe, it's a limitation for sure.