Download MetaTrader 5

CopyTicks help

To add comments, please log in or register
Find out the most discussed Forum topics. Have a look at the Wall section!
theDUDE
43
theDUDE 2016.01.04 00:43 

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());
      }
   }  

 


Jian Chen
Moderator
3621
Jian Chen 2016.01.04 08:51  

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 :(

Alain Verleyen
Moderator
30745
Alain Verleyen 2016.01.04 17:38  
theDUDE:

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

I don't know why.

 

Which MT5 build ?
theDUDE
43
theDUDE 2016.01.04 23:52  

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 

theDUDE
43
theDUDE 2016.01.04 23:59  
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. 

Jian Chen
Moderator
3621
Jian Chen 2016.01.05 03:32  

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. 

Alain Verleyen
Moderator
30745
Alain Verleyen 2016.01.05 08:01  
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.
To add comments, please log in or register