Subscription to OnBookEvent sometimes falls off - is there such a thing?

 

After I have started working with the tumbler and added some indicators signed to OnBookEvent, I have found that some of them silently fall off, in particular, 1 expert and 1 indicator on different symbols. No errors in the logs. The quotes kept going. Other symbols continued to work. After manually restarting the idle MQL-programs, the events of the market depth have started working again.

Has anyone observed anything similar? How to protect myself? For now, the idea to watch the timeout between the last event of the cup and new ticks. But what to do if timeout is exceeded? Is it enough to callMarketBookAdd again?

 

Previously it was called "zombie", perhaps a search will still find old threads.

This happens when the experts/indicators unsubscribe from the tumblr more times than they subscribe.

For example there were 2 experts, each signed up once. Then one was closed and unsubscribed twice. The second expert who has remained employed stops receiving updates.

I have seen it several times.

After adjusting the experts the problem disappeared and has not recurred for more than a year.

 
Ilya Baranov:

Previously it was called "zombie", perhaps a search will still find old threads.

It happens when experts/indicators unsubscribe from a tumblr more times than they sign up.

Strictly speaking, it doesn't fit. I have a subscription done once in inite and an unsubscription done in deinite. Although I can't rule out the possibility that DeInit is somehow called more times than OnInit.

 
Stanislav Korotky:

Strictly speaking, it doesn't fit. I have subscription done once in Init and unsubscribe in DeInit. Although I can't rule out the possibility that DeInit is somehow called more times than OnInit.

If it's about indicators, check out this thread.

Последовательность выполнение Init() и DeInit()
Последовательность выполнение Init() и DeInit()
  • 2017.04.07
  • www.mql5.com
Всем привет ! Столкнулся с такой проблемой Написан индикатор или советник...
 
Sergey Savinkin:

If it's about the indicators, have a look at this thread.

Yes, there was such a topic, I even participated in it, but apparently the problem remains. But in the current case, one Expert Advisor has also lost its subscription.

OK, we'll do the tambourine dance.

 
Stanislav Korotky:

After I have started working with the tumbler and added some indicators signed to OnBookEvent, I have discovered that some of them silently fall off, in particular, 1 expert and 1 indicator on different symbols. No errors in the logs. The quotes kept going. Other symbols continued to work. After manually restarting the idle MQL-programs, the events of the market depth have started working again.

Has anyone observed anything similar? How to protect myself? For now, the idea to watch the timeout between the last event of the cup and new ticks. But what to do if timeout is exceeded? Is it enough to call MarketBookAdd again?

There are two types of switches,- a button and a switch. The first sends a pulse and terminates the operation, the second involves a change of operating mode. An example of the first is a doorbell, which is the ideal event. An example of the second is a light switch - you press it and it lights up. You see, this is not really an event, but something more.

 
Алексей Тарабанов:

Switches are of two types, pushbuttons and switches. The first sends a pulse and terminates operation, the second involves a change of operating mode. An example of the first is the doorbell, which is the ideal event. An example of the second is a light switch - you press it and it lights up. You see, it's not really an event, it's something more.

No, I don't. Judging by the documentation, subscribing increases the internal counter, while unsubscribing decreases it by 1. Once it reaches 0 - no events are sent out.

I put the prints in. Achieved reproduction of the problem when both EA and indicator sit on the same chart. Each of them does MarketBookAdd in OnInit and MarketBookRelease in OnDeinit. So, after I remove the Expert Advisor from the chart (one call of MarketBookRelease), the indicator stops getting the cup (although in idea, its own call of MarketBookAdd is not cancelled yet). On the contrary, if we delete the indicator, the subscription is lost in the Expert Advisor. Of course, I detect it and subscribe again, but it should not work like that, imho.

 
Stanislav Korotky:

No, I don't. According to the documentation, subscribing increases the internal counter and unsubscribing decreases it by 1. When it reaches 0, no events are sent out.

I have put the printers in place. Achieved reproduction of the problem when both EA and indicator sit on the same chart. Each of them does MarketBookAdd in OnInit and MarketBookRelease in OnDeinit. So, after I remove the Expert Advisor from the chart (one call of MarketBookRelease), the indicator stops getting the cup. On the contrary, if I remove the indicator, the subscription is lost in the Expert Advisor. Of course, I detect it and subscribe again, but it should not work that way, imho.

I have already said it all. I will not say a word.

 
Stanislav Korotky:

No, I don't. According to the documentation, subscribing increases the internal counter and unsubscribing decreases it by 1. When it reaches 0, no events are sent out.

I have put the printers in place. Achieved reproduction of the problem when both EA and indicator sit on the same chart. Each of them does MarketBookAdd in OnInit and MarketBookRelease in OnDeinit. So, after I remove the Expert Advisor from the chart (one call of MarketBookRelease), the indicator stops getting the cup (although in idea, its own call of MarketBookAdd is not cancelled yet). On the contrary, if we delete the indicator, the subscription is lost in the Expert Advisor. Of course, I already detect it and subscribe again, but it shouldn't work this way, imho.

The BookEvent event is broadcast. Read the description of OnBookEvent here carefully.

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
В языке MQL5 предусмотрена обработка некоторых предопределенных событий. Функции для обработки этих событий должны быть определены в программе MQL5: имя функции, тип возвращаемого значения, состав параметров (если они есть) и их типы должны строго соответствовать описанию функции-обработчика события. Именно по типу возвращаемого значения и по...
 
Stanislav Korotky:

After I have started working with the tumbler and added some indicators signed to OnBookEvent, I have found that some of them silently fall off, in particular, 1 expert and 1 indicator on different symbols. No errors in the logs. The quotes kept going. Other symbols continued to work. After manually restarting the idle MQL-programs, the events of the market depth have started working again.

Has anyone observed anything similar? How to protect myself? For now, the idea to watch the timeout between the last event of the cup and new ticks. But what to do if the timeout is exceeded? Is it enough to call MarketBookAdd again?

Read this

https://www.mql5.com/ru/forum/95131

invalid book transaction
invalid book transaction
  • 2016.09.06
  • www.mql5.com
Раньше не было, появилось сегодня (реал). Что это...
 

Thanks ;-). Of course I have read the documentation and the forum. If there is an answer to my question, it would be very kind to articulate it or highlight it here.

In particular, there is a fascinating phrase in the documentation:

В отличие от других событий, событие BookEvent является широковещательным. Это означает, что достаточно одному эксперту подписаться на получение события BookEvent с помощью функции MarketBookAdd, все остальные эксперты, имеющие обработчик OnBookEvent(), будут получать это событие.

Except that it leaves one guessing whether or not to continue with the analogy that "enough for one expert to unsubscribe from receiving an event, all the other experts will also stop receiving it"? I don't think there can be such a thing, it would (or is) a bug.