CopyTicks (CopyTicksRange) MQL5 problem

 

Hello, everyone.

Can't defeat the problem. I use functions CopyTicks or CopyTicksRange from OnTimer callback. Our account is in Finam broker. The trade begins at 10.00 in Moscow. So ticks from 10.00 to 11.00 are not returning for some securities on the first day of Metatrader launch. On the next day all ticks are provided. I thought that it's my mistake somewhere. But I developed two different ways to get ticks in OnTimer and both of them produce nearly the same result. CopyTicks and CopyTicksRange don't return any error result but empty ticks arrays. What is the problem. Is it the problem of metatrader platform (not possible, because I can see ticks in quotes window), or is it the problem of my broker server?

Thanks a lot for any help. 

 
antru:

Hello, everyone.

Can't defeat the problem. I use functions CopyTicks or CopyTicksRange from OnTimer callback. Our account is in Finam broker. The trade begins at 10.00 in Moscow. So ticks from 10.00 to 11.00 are not returning for some securities on the first day of Metatrader launch. On the next day all ticks are provided. I thought that it's my mistake somewhere. But I developed two different ways to get ticks in OnTimer and both of them produce nearly the same result. CopyTicks and CopyTicksRange don't return any error result but empty ticks arrays. What is the problem. Is it the problem of metatrader platform (not possible, because I can see ticks in quotes window), or is it the problem of my broker server?

Thanks a lot for any help. 

Write your code for CopyTicks and CopyTicksRange please.
 
Alexey Volchanskiy:
Write your code for CopyTicks and CopyTicksRange please.
void OnTimer()
{
   // some code here

   MqlDateTime mdt;
   TimeGMT(mdt);

   // some code here

   if (!g_bEnterInfoSent && mdt.hour + 3 == 9)
   {
      MqlDateTime startTime;
      TimeGMT(startTime);
      startTime.hour = 7;
      startTime.min = 0;
      startTime.sec = 0;
      g_dStartTime = StructToTime(startTime);
      g_dDayBegin = g_dStartTime;
      
      startTime.hour = 17;
      startTime.min = 0;
      startTime.sec = 0;
      g_dEndOfTheDay = StructToTime(startTime);
   }

   // some code here

   datetime lastTime = TimeGMT();
  
   if (lastTime-1 > g_dStartTime && lastTime < g_dEndOfTheDay)
   {
      MqlTick tick[];
      int nResult = CopyTicksRange(Symbol(), tick, COPY_TICKS_ALL, (ulong)g_dStartTime*1000, (ulong)(lastTime-1)*1000);
      
      if (nResult > 0)
      {
         int nSize = ArraySize(tick);
        
         for (int i = 0; i<nSize; i++)
         {
             // some code here
         }
      
         g_dStartTime = lastTime;
      }
   }
}
Here you are. The code isn't complete but may be the error hides somewhere in these lines.
 

forgot on thing. I pasted cuts of code and didn't copied that g_bEnterInfoSet of course gets true value in that part of code

 

if (!g_bEnterInfoSent && mdt.hour + 3 == 9)
   {
      MqlDateTime startTime;
      TimeGMT(startTime);
      startTime.hour = 7;
      startTime.min = 0;
      startTime.sec = 0;
      g_dStartTime = StructToTime(startTime);
      g_dDayBegin = g_dStartTime;
      
      startTime.hour = 17;
      startTime.min = 0;
      startTime.sec = 0;
      g_dEndOfTheDay = StructToTime(startTime);

      g_bEnterInfoSent = true;
   }
 
One comment. Today ticks between 10.00 and 11.00 are not provided on some securities again. Metatrader was launched on friday, 03.02.2017.
 
antru:
One comment. Today ticks between 10.00 and 11.00 are not provided on some securities again. Metatrader was launched on Friday, 03.02.2017.Hi,

Hi, Have you ever figured out the problem? I also ran into similar one. The CopyTicksRange function seems to behave completely random as soon as a new day begins. Sometimes it returns the latest ticks and sometimes it returns the last tick from the previous day or even a few days ago and not the complete data set.

Personally, I think this is a Metatrader5 problem and not the broker's server, but I may be wrong. 

 

hi

this post is very old but the problem is not solved.

i have same problem.

i checked  many stocks  on  mt5 and compared it with real list of tardes and saw in many cases the trades info on mt5 were be lost!

any help?

thankyou.

 
s88719:

hi

this post is very old but the problem is not solved.

i have same problem.

i checked  many stocks  on  mt5 and compared it with real list of tardes and saw in many cases the trades info on mt5 were be lost!

any help?

thankyou.

Proofs ?
 
Alain Verleyen:
Proofs ?

The problem persists (including the ticks with "0" value - also reported years ago). Furthermore, this thing has been driving me crazy for some time so I narrowed it down the MT5 platform itself (no MQL5 code at all).

I managed to reproduce the issue numerous times using tick download from the "Symbols" panel in the terminal. Using the "CopyTicks" function will manifest the same problem.

I recorded a short video documenting this. Maybe the developers will seriously consider taking a look at the issue sometime soon. I work with many trading platforms and have never encountered tick data inconsistency to this extent.

Too bad there is no direct channel for submitting bugs.


 
Artur Zas:

The problem persists (including the ticks with "0" value - also reported years ago). Furthermore, this thing has been driving me crazy for some time so I narrowed it down the MT5 platform itself (no MQL5 code at all).

I managed to reproduce the issue numerous times using tick download from the "Symbols" panel in the terminal. Using the "CopyTicks" function will manifest the same problem.

I recorded a short video documenting this. Maybe the developers will seriously consider taking a look at the issue sometime soon. I work with many trading platforms and have never encountered tick data inconsistency to this extent.

Too bad there is no direct channel for submitting bugs.


Sorry but I can't follow your video as you recorded the whole desktop but only use a small part of it for MT5. It's too small for me, I can't read. The second part is better as it's full screen (though not optimal for my 17" laptop).
 
Alain Verleyen:
Sorry but I can't follow your video as you recorded the whole desktop but only use a small part of it for MT5. It's too small for me, I can't read. The second part is better as it's full screen (though not optimal for my 17" laptop).
From what I understood nonetheless, it seems you have more ticks AFTER restarting MT5 right ? So it seems a cache issue, where before closing, the ticks in the cache are not available.