I got some manually drawn objects on my chart and I need to get time and price of them. I do it like this:
foreach (IDrawingTool draw in DrawObjects.ToList()) //safe copy
{
if (!draw.IsUserDrawn || draw.IsSelected) continue;
if (draw.ToString().Equals("NinjaTrader.NinjaScript.DrawingTools.ArrowUp"))
{
ArrowUp up = draw as DrawingTools.ArrowUp;
if (up != null)
{
DateTime time = up.Anchor.Time;
double price = up.Anchor.Price;
//do something
}
}
}
If I draw another arrow this code works and I can get time and price but it doesn't for previous drawn arrows. If I refresh indicator all arrows become null again.

Comment