I'm trying to access various properties of Manually created horizontal lines on the chart through the following code [Similar to https://ninjatrader.com/support/help...wobjects.htm]:
//go through all objects on the chart
foreach (DrawingTool pO_DrawingTool in DrawObjects.ToList())
{
// Finds line objects that are attached globally to all charts of the same instrument
if (pO_DrawingTool is DrawingTools.HorizontalLine)
{
// ensure it has the desired tag name
if (pO_DrawingTool.Tag.CompareTo(is_TagName) == 0)
{
DrawingTools.HorizontalLine lO_HL = pO_DrawingTool as DrawingTools.HorizontalLine;
// add this desired horizontal line's information
gs_List_currID.Add(pO_DrawingTool.Id);
gd_List_currPrice.Add(Instrument.MasterInstrument.RoundToTickSize(lO_HL.StartAnchor.Price));
gd_List_currWidth.Add(lO_HL.Stroke.Width);
gs_List_currColor.Add(lO_HL.Stroke.Brush.ToString());
gs_List_currStyle.Add(lO_HL.Stroke.DashStyleHelper.ToString());
}
}
}
https://ninjatrader.com/support/helpGuides/nt8/en-us/?considerations_for_compiled_assemblies.htm
//go through all objects on the chart
foreach (dynamic pO_DrawingTool in DrawObjects.ToList())
{
// Finds line objects that are attached globally to all charts of the same instrument
//if (pO_DrawingTool is NinjaTrader.NinjaScript.DrawingTools.HorizontalLine)
if (pO_DrawingTool.ToString().Equals("NinjaTrader.NinjaScript.DrawingTools.HorizontalLine") == true)
{
// ensure it has the desired tag name
if (pO_DrawingTool.Tag.CompareTo(is_TagName) == 0)
{
dynamic lO_HL = pO_DrawingTool as DrawingTools.HorizontalLine;
//
if (lO_HL != null)
{
// add this desired horizontal line's information
gs_List_currID.Add(pO_DrawingTool.Id);
gd_List_currPrice.Add(Instrument.MasterInstrument.RoundToTickSize(lO_HL.StartAnchor.Price));
gd_List_currWidth.Add(lO_HL.Stroke.Width);
gs_List_currColor.Add(lO_HL.Stroke.Brush.ToString());
gs_List_currStyle.Add(lO_HL.Stroke.DashStyleHelper.ToString());
}
}
}
}
dynamic lO_HL = pO_DrawingTool as DrawingTools.HorizontalLine;
It will be very helpful, if someone may provide me pointers towards the solution for this.
Thank You!

Comment