I'm having trouble confirming (or getting) the type for IChartObjects on a chart. My objective is to use OnRender() to check for a type and if it is a horizontal line, then I want to write the value of that line. For example, if that line is drawn by using F6 at 1150 on a TF chart, then I want to write "1150.0" for reference on that chart, just over that horizontal line.
I'm sure I can do that using RenderObject but I can't get to the point where I can even call RenderObject.
Consider the code:
foreach (Gui.NinjaScript.IChartObject c in myObjects) { if( c.Name == "Horizontal Line" ) { NinjaTrader.NinjaScript.DrawingTools.HorizontalLine chl = c as NinjaTrader.NinjaScript.DrawingTools.HorizontalLine; } }
And if I check like this, which I'd rather do than the above, I never get into the code where I can use the values for "c":
foreach (Gui.NinjaScript.IChartObject c in myObjects) { if( c is HorizontalLine ) { NinjaTrader.NinjaScript.DrawingTools.HorizontalLine chl = (c as NinjaTrader.NinjaScript.DrawingTools.HorizontalLine); } }
Can you help?
Comment