That tool is not exposed via the usual Draw factory class. You have to create and remove it manually. Removal is actually trickier than creation. Here’s a code snippet that creates and removes a volume profile drawing tool. Call the removal in State==State.Terminated for every tool you create. Use draw to create a tool when needed.
I’ve successfully created the built-in DrawingTools.OrderFlowVolumeProfile from a custom NinjaScript indicator thanks to Mark’s tip above .
It is drawing correctly, but I want to know whether there is a supported way to force that Volume Profile drawing tool to render on top of candles / other chart objects . Some way of duplicating the funtion of the right mouse menu “bring to front”
I’m glad the other code is working for you. I managed to fix the removal issue i was having with that code. Here’s a much cleaner version that creates the drawing tool properly owned by it’s parent indicator so it doesn’t need special remove handling.
To set Z-Order so the drawing tool is always on top, I would try setting the ZOrderType on the drawing tool object to DrawingToolZOrder.AlwaysDrawnLast
I had already tried dt.ZOrderType = DrawingToolZOrder.AlwaysDrawnLast;, but I had it placed before dt.SetState(State.Active); along with the other volume profile properties.
Once I moved it to afterdt.SetState(State.Active);, it worked.
Thanks as well for the cleaner version of the code. I have it working now, but your new approach looks much better, so I’m going to recode it using that method.