The notification and the snapshot

An MQL5 program can subscribe to depth-of-market events with MarketBookAdd. OnBookEvent receives the symbol involved. The program can then call MarketBookGet to read book data. Notifications are broadcast to handlers on the same chart, so every handler should check the symbol before recording an event. MQL5 · OnBookEvent ↗

Why timestamps need care

If more changes arrive before the handler reads the book, the snapshot it obtains is the current state at the time of the call. Treat a book reading as a snapshot. Record the local capture time and any available provider metadata separately. A sequence of book snapshots is useful for monitoring, but cannot reconstruct every intermediate change by itself.

How to test who owns a subscription

Run two chart programs that subscribe to the same symbol. Remove one and check that the other still receives events. Each program should balance its successful subscriptions with matching MarketBookRelease calls and ignore notifications for symbols it does not track. MQL5 · OnBookEvent ↗