When I add the indicator to a chart, Draw.Text sometimes draws behind the custom plot and sometimes it draws on top of the plot. These two cases are also different when it comes to the number of plot levels on the chart.
Case 1: Draw.Text plots on top of the plot (as it should be). When I select a text object via Shift + Mouse Wheel it shows level 2 of 2. In this case level 1 is used for the price bars, and level 2 is used for the indicator including the text objects.
Case 2: Draw.Text plots behind the plot (see chart attached). When I select a text object via Shift + Mouse Wheel it shows level 4 of 4. In this case level 4 is used for the text objects, while level 2 or 3 is used for the plot and level 1 is used for the price bars. One of those levels is a mystery level with no objects attached to it, as there is nothing else on the chart than the price bars, the plot and the text objects.
Why does the same indicator use 2 levels in case 1 and 4 levels in case 2? NinjaTrader has always had problems controlling the ZOrder of different objects, but the random behavior I am observing here is more than strange.
Is it possible to control the behavior programmatically? ZOrder does not help, as it only controls the level of the plot relative to the price bars, while the behavior of Draw.Text remains random.
Please find attached screenshot of the two cases. Both screenshots show the same single indicator added to the same chart.
Comment