src/Deepdom/Book/BookImbalance.cs
The share of the order book which is on the bid side, over the first levels of each side: a line in an area of its own and a label on the chart.
What it shows
OnBookand the updates of the book.FullIniDepth, the book at the first bar of the chart.LiquiditySumHelper.- A label with relative coordinates, drawn on the foreground.
How it works
The helper sums the firstLevels levels of each side. It is created in OnLoad, and the first OnBook applies the initial snapshot before the updates:
Draw writes the point of the current bar and the label:
Things to notice
- The point is written with
BookIndex: the book belongs to the bar being built, see Two indices. - The label uses relative coordinates (
0.02,0.95) and a group withPlotForeground = true: it stays at the top left, over the bars. FullIniDepthis read from the firstOnBook, not fromOnLoad: it is empty before the bars start.
Try
- Draw the two sums as two series instead of the share.
- Add a parameter to count the levels within a number of ticks from the best price instead of a fixed number of levels.