Tiki in real time - page 21

 
Aleksey Mavrin:

That's the picture for the day. Of course we did not check whether OnBook matched Tick, but just took the next one, hoping that if OnTick was ahead of OnBook, then the corresponding one would be either the same or slightly later.

Maximum of course without additional checks is no indicator, or overshoot or really OnBook somewhere slow.


But this is someone who can explain? Why so many OnTicks are deployed, and not a single OnBook fits between them?


Because you yourself wrote"The code is cranked, maybe it's crooked, I'll look at the results."

//+------------------------------------------------------------------+
//| BookEvent function                                               |
//+------------------------------------------------------------------+
void OnBookEvent(const string &symbol)
{ 
  if((Mode != USE_BOOK) || (symbol != Symbol())) return;
  TimeArrayBook[curBook]=GetMicrosecondCount();
  curBook++
 }
void OnTick()
{
  if(Mode != USE_TICK) return;
  TimeArrayTick[curTick]=GetMicrosecondCount();
  curTick++
}

And you don't need a timer at all...

 
But I wonder if the person in charge is satisfied with the answers to his question.
 
prostotrader:

Because you yourself wrote: "The code is cranked up, maybe it's crooked, I'll look at the results. "

And you don't need a timer at all...

You didn't find that the reason was because of errors in the code. Or you didn't understand the question. I have output a mark in On functions, without timer, but there is still a bunch of ticks between which there are no OnBooks.
 
Aleksey Mavrin:
You didn't find that the cause is due to errors in the code. Or you didn't understand the question. I also just printed a mark in On functions, without timer, still there is a crowd of ticks between which there are no OnBooks.

1. It is not clear to me at all how you ran the EA(s)

2. There are 2 codes written by Andrei and myself which

Theycorroborate each other. So why bother with yours?

3. Both Andrey and I have run EAs on the Derivatives market, and you on the Stock market.

Maybe the terminal has some flaws on the Fund (Didn't even run MT5 on the Stock market).

Personally, on the Fund, I trade via Quick

 
prostotrader:

1. It is not clear to me at all how you ran the EA(s)

2. There are 2 codes written by Andrei and myself which

They corroborate each other. So why bother with yours?

3. Both Andrey and I have run EAs on the Derivatives market, and you on the Stock market.

Maybe the terminal has some flaws on the Fund (I haven't even run MT5 on the Stock market).

Personally, on the Fund, I trade through Quick

Oh, I see. I'll try it on the futures tomorrow. Why don't you use mt5 on the fund? Are there any disadvantages?
Z.s. The code there is 3 lines) just fixes the msk time without any checks so that the queue is not slowed down in any way by the handler, and on the timer it prints and counts the delay. I did not understand your code thoroughly either, the general principle of operation is already clear from the output.
 
Aleksey Mavrin:
1. Ah, I see. Tomorrow I will try it on a futures one. Why do you not use MT5 on the fund? Do you have any disadvantages?
S.s. The code there is 3 lines) just fixes the msc time without any checks so that the queue is not slowed down in any way by the handler, and on the timer it prints it and counts the delay. I did not understand your code thoroughly either, the general principle of operation is already clear from the output.

1. The second and subsequent terminals at the broker are paid, and I don't have strategies where I trade only stocks(stock portfolios).

2. If you are going to output the accumulatedGetMicrosecondCount(), then

do it without timer in OnDeinit(), when the EA exits, everything will print out.

void OnDeinit(const int reason)
{
  if(Mode == USE_BOOK)
  {
    if(is_book == true) MarketBookRelease(Symbol());
  } 
  if(reason == REASON_REMOVE)
  {
   //Распечатываем данные
  } 
}
 
prostotrader:

2. If you are going to output the accumulatedGetMicrosecondCount(), then

do it without timer in OnDeinit(), when EA exits, everything will print out.

You can do it that way too, I initially did it that way to keep track of it. But due to the timer, OnTicks may be skipped, but OnBooks should not be, since they are guaranteed. Maybe I did not take something into account, maybe not all Ticks initiate a change of the cup, i.e. OnBook?
 
Aleksey Mavrin:
Yes, you can do it that way too, I originally did it that way to make it clearer. But because of the timer OnTicks may be skipped, but OnBooks should not, they are guaranteed. Maybe I did not take something into account, maybe not all Ticks initiate a change of the glass, i.e. OnBook?

Also.

You need to check the counters:

void OnBookEvent(const string &symbol)
{ 
  if(curBook >= 65534) return;
  if((Mode != USE_BOOK) || (symbol != Symbol())) return;
  TimeArrayBook[curBook]=GetMicrosecondCount();
  curBook++
 }
void OnTick()
{
  if(curTick >= 65534) return;
  if(Mode != USE_TICK) return;
  TimeArrayTick[curTick]=GetMicrosecondCount();
  curTick++
}

A, when declaring arrays, do the following

ulong TimeArrayBook[
INT_MAX];

а инициализировать так
ArrayInitialize(TimeArrayBook, 0);

	          
 
prostotrader:

Also.

We need to do a counter check:

A, on initialisation the number should be65535 not65536

Nope, not necessary. It's deliberately done that way so as not to check anything. They are Ushort. The size of the array is excessive, but it doesn't affect anything.
 
Aleksey Mavrin:

Who can explain this? Why are so many OnTicks being deregistered and not a single OnBook between them?

Look at the time of the log. This all happened in one ms, and next to it (in the same ms) a bunch of OnBooks.

You can count all events by counters, but even visually you can see that there are more OnBooks.