Tick story - page 24

 
juriy5555:

Judging by the tick indicator queries, the time_msk field data is a multiple of 1000. i.e. we are not talking about milliseconds, the resolution is 1 second.

Question: what was the point in extending MqlTick structure then?

And what trade server did you connect to?
 
I have a demo at Openbroker and a real account there as well. On the real all Access servers give the same result. well, and on the demo is the same. I looked at Si-6.16, RTS-6.16, SBRF-6.16. All changes are multiples of 1000.
It is not so at you?
 
juriy5555:
I have a Demo on Openbroker and a real account on the same place. On the real all Access server gives the same result. well on the demo the same. Looked at Si-6.16, RTS-6.16, SBRF-6.16. All changes are multiples of 1000.
Do you not so?

Right now, the SymbolInfoTick query returns zeros in the MqlTick structure instead of real milliseconds (a multiple of 1000)

Please wait for the next build.

PS on request CopyTicks milliseconds are given as is

 

I downloaded this indicator from this thread to test it. It gets the last 30 ticks exactly via CopyTicks. Alternatively, maybe I should try it on a different server (not openbroker).

>>"zeros are given instead of real milliseconds".

Not zeros are given, but always the same numbers with a multiple of 1000. (...2064, ...2064, ...3064, ..., ..., ..4064 )

Files:
 
juriy5555:

I downloaded this indicator from this thread to test it. It gets the last 30 ticks exactly via CopyTicks. Alternatively, maybe I should try it on a different server (not openbroker).

>>"zeros are given instead of real milliseconds".

Not zeros are given, but always the same numbers with a multiple of 1000. (...2064, ...2064, ...3064, ..., ..., ..4064 )

Zeros are passed by the SymbolInfoTick function.

In CopyTicks real milliseconds are given. If these are 2064, 3064, 4064, it means that it was so. Why it was so, I don't know.

I looked through your code. What is the %-4d output specifier? time_msc is long, so just d does not work. It should be %I64d.

 
Slawa:

The zeros are given by the SymbolInfoTick function.

In CopyTicks real milliseconds are given. If it is 2064, 3064, 4064, so it was. Why it was so, I do not know.

I looked through your code. What is the %-4d output specifier? time_msc is long, so just d does not work. It should be %I64d.

Yes, sorry. The code is not mine. The author of the code really has a slip in StringFormat. I printed in each iteration of the loop through Print (tick.time_msc) . The result is all zeros at the end and we still get no milliseconds. TheCopyTicks requestpersists.

Files:
99999.jpg  332 kb
 
Slawa:

The zeros are given by the SymbolInfoTick function.

In CopyTicks real milliseconds are given. If it is 2064, 3064, 4064, so it was. Why it was so, I don't know.

Looked at your code. What is the output specifier %-4d? time_msc - it's long, that's why just d does not work. It should be %I64d.

Changed indicator from the first post - don't play with StringFormat, it should be like that now:

string tick_string=IntegerToString(i,2,'0')+"  "+TimeToString(tick.time,TIME_MINUTES|TIME_SECONDS)+"  "+
                            DoubleToString(tick.bid,Digits())+"  "+DoubleToString(tick.ask,Digits())+"  "+
                            DoubleToString(tick.last,Digits())+"  "+IntegerToString(tick.volume,7,'0')+"  "+
                            IntegerToString(tick.time_msc,19,'0')+"  "+IntegerToString(tick.flags,2,'0');
 
juriy5555:

Yes, sorry. The code is not mine. The author really has a bug in StringFormat. Print (tick.time_msc) in each iteration of the loop. The result is all zeros at the end and we still get no milliseconds. The requestCopyTicks goes all the time.

Here is your indicator on MetaQuotes Demo data


Ask your broker about absence of milliseconds in ticks

 
Slawa:

Here is your indicator on MetaQuotes Demo data


Ask your broker about the lack of milliseconds in ticks

I don't know what and who to write to yet, I've been at it for a few months. I hope that OpenBroker will update the server after all.
ps my client build 1340
 

juriy5555 :
Пока не знаю, что и у кому конкретно писать, я в этом несколько месяцев.  Буду надеяться, что  ОпенБрокер всё таки обновит сервер. 
ps мой билд клиента 1340

I also have a question, though a little different plan, and I also wonder if the information transmitted from the ticks is correct.

A question about real volumes.

If you request information on ticks from the indicator, then the real volume goes there in the volume[] array. And, in theory, if you get information from ticks, then the volume accumulated per candle should match the value from the volume[] array.

Here is an example of test code:

 //+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping

//---
   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[])
  {
//--- Получение данных по тику
   MqlTick tick;                                               // Структура хранения инфо по тику
   SymbolInfoTick ( _Symbol ,tick );                             // Получение данных по тику
   Print ( "ask: " + DoubleToString (tick.ask, _Digits )+ ", bid: " + DoubleToString (tick.bid, _Digits )+ ", last: " + DoubleToString (tick.last, _Digits )+
         ", vol: " ,tick.volume, ", flags: " ,tick.flags);
//--- Формирование объема
   static ulong sVol;                                         // Суммарный объем из тиков на свече
   if (prev_calculated<= 0 )                                     // Если первый запуск
      sVol=tick.volume;                                       // Запоминаем значение тика
   else
     {
       if (rates_total>prev_calculated) // Если образовалась новая свеча
        {
         sVol=tick.volume;                                     // Запоминаем значение объема первого тика
        }
       else                                                      // Если новая свеча не образовалась
         sVol+=tick.volume;                                    // Суммируем объем тика с накопленным объемом
     }
   Print ( "Реальный объем: " ,volume[rates_total- 1 ], ", накопленный объем: " ,sVol);
//--- 
   return (rates_total);
  }
//+------------------------------------------------------------------+

Let's not get attached to the flags for now, and assume that each received tick changes the total volume of sVol (although, as far as I know, this is not the case).

We are waiting for the formation of a new candle and look at the entries in the journal. Broker Opening, real account, build 1340, RTS-6.16:

 2016.06 . 09 17 : 07 : 01.820 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 1 , накопленный объем: 1
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 3 , flags: 24
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 1 , накопленный объем: 4
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 3 , flags: 24
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 5 , накопленный объем: 7
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 3 , flags: 24
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 7 , накопленный объем: 10
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 3 , flags: 24
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 8 , накопленный объем: 13
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 3 , flags: 24
2016.06 . 09 17 : 07 : 03.142 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 11 , накопленный объем: 16
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 16 , накопленный объем: 17
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 18 , накопленный объем: 18
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 03.266 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 19 , накопленный объем: 19
2016.06 . 09 17 : 07 : 03.700 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94660 , vol: 1 , flags: 24
2016.06 . 09 17 : 07 : 03.700 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 20 , накопленный объем: 20
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 22 , накопленный объем: 21
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 27 , накопленный объем: 22
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 28 , накопленный объем: 23
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 29 , накопленный объем: 24
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 31 , накопленный объем: 25
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 33 , накопленный объем: 26
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 38 , накопленный объем: 27
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 43 , накопленный объем: 28
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 45 , накопленный объем: 29
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 47 , накопленный объем: 30
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 49 , накопленный объем: 31
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 51 , накопленный объем: 32
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 56 , накопленный объем: 33
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 59 , накопленный объем: 34
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 60 , накопленный объем: 35
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.319 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 60 , накопленный объем: 36
2016.06 . 09 17 : 07 : 04.347 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.347 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 61 , накопленный объем: 37
2016.06 . 09 17 : 07 : 04.347 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 04.347 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 61 , накопленный объем: 38
2016.06 . 09 17 : 07 : 05.344 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 05.344 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 63 , накопленный объем: 39
2016.06 . 09 17 : 07 : 05.344 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94680 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 05.344 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 64 , накопленный объем: 40
2016.06 . 09 17 : 07 : 05.460 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 24
2016.06 . 09 17 : 07 : 05.460 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 65 , накопленный объем: 41
2016.06 . 09 17 : 07 : 05.516 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 24
2016.06 . 09 17 : 07 : 05.516 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 68 , накопленный объем: 42
2016.06 . 09 17 : 07 : 05.516 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 24
2016.06 . 09 17 : 07 : 05.516 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 69 , накопленный объем: 43
2016.06 . 09 17 : 07 : 06.016 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 24
2016.06 . 09 17 : 07 : 06.016 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 70 , накопленный объем: 44
2016.06 . 09 17 : 07 : 06.557 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94670 , last: 94670 , vol: 1 , flags: 0
2016.06 . 09 17 : 07 : 06.557 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 71 , накопленный объем: 45
2016.06 . 09 17 : 07 : 06.702 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94670 , vol: 2 , flags: 2
2016.06 . 09 17 : 07 : 06.702 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 73 , накопленный объем: 47
2016.06 . 09 17 : 07 : 06.702 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94680 , bid: 94660 , last: 94670 , vol: 2 , flags: 2
2016.06 . 09 17 : 07 : 06.702 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 73 , накопленный объем: 49
2016.06 . 09 17 : 07 : 06.718 test_ticks_openbroker (RTS- 6.16 ,M1)     ask: 94670 , bid: 94660 , last: 94670 , vol: 2 , flags: 0
2016.06 . 09 17 : 07 : 06.718 test_ticks_openbroker (RTS- 6.16 ,M1)     Реальный объем: 74 , накопленный объем: 51

And so on, the real volume from the indicator will be much larger than the accumulated one. This raises a few questions for developers:

1. Should the volume obtained from the volume[] array of the OnCalculate() function be the same as the accumulated volume obtained from ticks? My opinion, of course, should, otherwise why indicate it in ticks?

2. Is it correct to use the OnCalculate() function to accumulate the volume, or is it better to get the volume through OnBookEvent()? The help says:

The Calculate event is generated only for indicators immediately after the Init event is sent and upon any change in price data. Handled by the OnCalculate function.

so, in theory, it is correct, but I would like to hear a comment on this.

3. Test results are shown WITHOUT flag analysis. If we analyze the flags, then, as far as I understand, you need to take volumes from ticks with flags 24 (simultaneous change in the last and volume):

  • TICK_FLAG_LAST - the tick changed the price of the last trade
  • TICK_FLAG_VOLUME - tick changed volume

But in this case, the accumulated volume will be even less. I would like to hear the developers' comments on how to correctly analyze ticks now (since all fields are recorded) and are the flags implemented correctly? The question about the correctness of the implementation arose because I did not notice ticks with flags:

  • TICK_FLAG_BUY - the tick occurred as a result of a buy deal
  • TICK_FLAG_SELL – a tick occurred as a result of a sell deal

What is the number of these flags?

The indicator file is also in the application.

Reason: