Bugs and suggestions for improving CopyTicks() and CopyTicksRange() after build 1485.

 

Continuing to fight to improve: ticks, access to ticks and tick synchronisation. @Slawa, @Renat Fatkhullin and people responsible for ticks, please join the discussion. I think we will find more than one error. Also, I think it will be interesting for @fxsaber, @coderex and other tick users.

Let's begin:

1. There's not a word about the new CopyTicksRange() function in ME build 1486 documentation. It's not very helpful from the website. Add it to the editor's documentation, please;

2. When trying to request ticks via CopyTicksRange():

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000 );

We constantly get -1 and error #4401 "requested history not found". And it should be like this:

Если параметр to_msc не указан, то отдаются все тики до конца истории.

The code is completely below:

//+------------------------------------------------------------------+
//|                                          test_CopyTicksRange.mq5 |
//|                                                         Tapochun |
//|                           https://www.mql5.com/ru/users/tapochun |
//+------------------------------------------------------------------+
#property copyright "Tapochun"
#property link      "https://www.mql5.com/ru/users/tapochun"
#property version   "1.00"
#property indicator_chart_window
#property indicator_plots 0
//---
#include <errordescription.mqh>
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
input datetime inpStartTime=__DATE__;   // Время начала загрузки истории
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   if(prev_calculated<=0)
     {
      //---
      UseCopyTicksRange();
      //---
      UseCopyTicks();
     }
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void UseCopyTicksRange()
  {
   MqlTick ticks[];
//--- Замеряем время старта перед получением тиков
   ulong start=GetMicrosecondCount();
//--- Запрашиваем тиковую историю
   int copied=CopyTicksRange(_Symbol,ticks,COPY_TICKS_TRADE,inpStartTime*1000);
//--- Рассчитаем, за сколько мс получена история
   ulong msc=GetMicrosecondCount()-start;
//--- Проверяем количество скопированных тиков
   if(copied>0) // Если история получена
     {
      //--- Выведем информацию о количестве тиков и затраченном времени
      Print(__FUNCTION__,": Получено ",copied," тиков за ",msc," мкс");
      //--- Проверка синхронизации тиковой истории
      if(GetLastError()==0) // Если история синхронизирована
        {
         //--- Выходим
         return;
        }
      else                                     // Если история рассинхронизирована - сообщение
        {
         Print(__FUNCTION__,": Получено ",copied," тиков за ",msc," мкс. Тики еще не синхронизированы!");
         return;
        }
     }
   else if(copied==0) // Если получено 0 тиков - сообщение
      Print(__FUNCTION__,": ВНИМАНИЕ! Получено 0 тиков. Возможно установлен некорректный параметр from ("+
            TimeToString(inpStartTime,TIME_DATE|TIME_SECONDS)+".",inpStartTime*1000%1000,"). Текущее время "+TimeToString(TimeCurrent()));
   else                                        // Если тики не получены - ошибка
   Print(__FUNCTION__,": ОШИБКА #",GetLastError()," ("+ErrorDescription(_LastError)+"). Тики не получены!");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void UseCopyTicks()
  {
   MqlTick ticks[];
//--- Замеряем время старта перед получением тиков
   ulong start=GetMicrosecondCount();
//--- Запрашиваем тиковую историю
   int copied=CopyTicks(_Symbol,ticks,COPY_TICKS_TRADE,inpStartTime*1000,10000000);
//--- Рассчитаем, за сколько мс получена история
   ulong msc=GetMicrosecondCount()-start;
//--- Проверяем количество скопированных тиков
   if(copied>0) // Если история получена
     {
      //--- Выведем информацию о количестве тиков и затраченном времени
      Print(__FUNCTION__,": Получено ",copied," тиков за ",msc," мкс");
      //--- Проверка синхронизации тиковой истории
      if(GetLastError()==0) // Если история синхронизирована
        {
         //--- Выходим
         return;
        }
      else                                     // Если история рассинхронизирована - сообщение
        {
         Print(__FUNCTION__,": Получено ",copied," тиков за ",msc," мкс. Тики еще не синхронизированы!");
         return;
        }
     }
   else if(copied==0) // Если получено 0 тиков - сообщение
      Print(__FUNCTION__,": ВНИМАНИЕ! Получено 0 тиков. Возможно установлен некорректный параметр from ("+
            TimeToString(inpStartTime,TIME_DATE|TIME_SECONDS)+".",inpStartTime*1000%1000,"). Текущее время "+TimeToString(TimeCurrent()));
   else                                        // Если тики не получены - ошибка
   Print(__FUNCTION__,": ОШИБКА #",GetLastError()," ("+ErrorDescription(_LastError)+"). Тики не получены!");
  }
//+------------------------------------------------------------------+

CopyTicks() returns correct result.

Files:
 

There's no way to get the story at all. I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE );

I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, 0, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000, (inpStartTime+72000)*1000 );

The answer is always the same:

2016.11.30 21:36:45.872 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:45.965 UseCopyTicks: Получено 288181 тиков за 93009 мкс
2016.11.30 21:36:47.908 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:48.011 UseCopyTicks: Получено 288186 тиков за 102971 мкс
2016.11.30 21:36:49.992 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:50.090 UseCopyTicks: Получено 288189 тиков за 98423 мкс

Tried it on VTBR-12.16, BR-12.16, RTS-12.16 futures. Tried it on COPY_TICKS_ALL ticks - same result. Dear developers, are you trolling the users? Or are you simply bored with testing your developments before release?

 
If you run the indicator on each tick - same result. No history is received.
 
Throttled the ticking history on the symbol - didn't help.
 
Alexey Kozitsyn:

There's no way to get the story at all. I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE );

I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, 0, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000, (inpStartTime+72000)*1000 );

The answer is always the same:

2016.11.30 21:36:45.872 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:45.965 UseCopyTicks: Получено 288181 тиков за 93009 мкс
2016.11.30 21:36:47.908 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:48.011 UseCopyTicks: Получено 288186 тиков за 102971 мкс
2016.11.30 21:36:49.992 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:50.090 UseCopyTicks: Получено 288189 тиков за 98423 мкс

Tried it on VTBR-12.16, BR-12.16, RTS-12.16 futures. Tried it on COPY_TICKS_ALL ticks - same result. Dear developers, are you trolling the users? Or are you simply bored with testing your developments before release?

 

Demotivator It's the 100th modification and it still doesn't work...

http://demotivatorium.ru/sstorage/3/2012/03/2703120956251657.jpg
 
Alexey Kozitsyn:

There's no way to get the story at all. I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE );

I tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, 0, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000 );

Tried this:

//--- Запрашиваем тиковую историю
int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_TRADE, inpStartTime*1000, (inpStartTime+72000)*1000 );

The answer is always the same:

2016.11.30 21:36:45.872 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:45.965 UseCopyTicks: Получено 288181 тиков за 93009 мкс
2016.11.30 21:36:47.908 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:48.011 UseCopyTicks: Получено 288186 тиков за 102971 мкс
2016.11.30 21:36:49.992 UseCopyTicksRange: ОШИБКА #4401 (Запрашиваемая история не найдена). Тики не получены!
2016.11.30 21:36:50.090 UseCopyTicks: Получено 288189 тиков за 98423 мкс

Tried it on VTBR-12.16, BR-12.16, RTS-12.16 futures. Tried it on COPY_TICKS_ALL ticks - same result. Dear developers, are you trolling the users? Or are you simply bored with testing your developments before release?

 

He who does not work, eats student

https://www.youtube.com/watch?v=yMit_zQnqlo

 

I think it's just a bug in the Web documentation, it's really still blank in ME. Or the function is still in development. Second, you're requesting data from somewhere from 1970 and wonder why ticks from the last century aren't giving back ))!!! What are you smoking there?

That's how it works.

void OnStart()
{
    datetime dt1 = D'2016.11.28 00:00:00', dt2 = D'2016.11.30 00:00:00';
    MqlTick ticks[];
    ulong start, msc;
    //--- Замеряем время старта перед получением тиков
    start=GetMicrosecondCount();
    int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_ALL, dt1*1000, dt2*1000);
//--- Рассчитаем, за сколько мс получена история
    msc=GetMicrosecondCount()-start;
    Print("copied=", copied, "   msc=", msc);
    return;
}

// вывод
2016.12.01 04:52:08.134 TestCopyTicks (EURUSD.m,M15)    copied=333081   msc=1294871
2016.12.01 04:52:16.877 TestCopyTicks (EURUSD.m,M15)    copied=333081   msc=318596

***

 
Alexey Volchanskiy:

I think it's just a bug in the Web documentation, it's really not in ME yet. Or the function is still in development. Second, you're requesting data from somewhere from 1970 and wonder why ticks from the last century aren't giving back ))!!! What are you smoking there?

That's how it works.

void OnStart()
{
    datetime dt1 = D'2016.11.28 00:00:00', dt2 = D'2016.11.30 00:00:00';
    MqlTick ticks[];
    ulong start, msc;
    //--- Замеряем время старта перед получением тиков
    start=GetMicrosecondCount();
    int copied = CopyTicksRange( _Symbol, ticks, COPY_TICKS_ALL, dt1*1000, dt2*1000);
//--- Рассчитаем, за сколько мс получена история
    msc=GetMicrosecondCount()-start;
    Print("copied=", copied, "   msc=", msc);
    return;
}

// вывод
2016.12.01 04:52:08.134 TestCopyTicks (EURUSD.m,M15)    copied=333081   msc=1294871
2016.12.01 04:52:16.877 TestCopyTicks (EURUSD.m,M15)    copied=333081   msc=318596

***

Alexey, thanks for getting involved in the tests. As you can see, I've tried both from a specific date and to a specific date and without a date. But the point is: 1. I used __DATE__ and there seems to be trouble with macro substitutions; 2. I tested on futures; Yes, if you look at the documentation - it should have at least started loading ticks. However - nothing happens.

Have you tried to run my indicator in your environment?

Reason: