Updates
WithOnBookCall set, OnBook receives the changes of the book as they are applied to the chart, in groups:
mbpUpdates is the book by price. mboUpdates holds the orders of the same updates, when the data feed gives them; most indicators need only the prices.
Several groups of updates belong to the same bar: OnBook is called for each one, OnBookClose when the bar is complete. The book is received when the chart shows the order book (the default); an indicator which only needs the trades does not ask for it.
The initial snapshot
The chart shows the last part of the session, and the firstOnBook is a change, not the whole book. The book as it was at the first bar of the chart is in Vbk.FullIniDepth, a collection of BookInfo indexed by price:
OnBook on, not in OnInit or OnLoad.
LiquiditySumHelper
Most indicators of the book want the quantity resting on the first levels of each side.LiquiditySumHelper, in VolBookAPI, keeps that sum up to date from the updates:
The Book Imbalance example draws the bid share of the book.