I am trying to use the StartAnchor.Time to print out the price of the bar that the StartAnchor is drawn on a bar it does return the bar number and when querying the startAnchor.time it returns the correct time
But when doing Close[Bars.GetBar(StartAnchor.Time)] it fails and says that OnBarUpdate method on bar 0 even though it returns a value when just querying the bar number.
foreach(DrawingTool draw in DrawObjects.ToList())
{
if(draw is DrawingTools.RegionHighlightX)
{
if(draw.Tag == r.Tag)
{
DrawingTools.RegionHighlightX rec = draw as DrawingTools.RegionHighlightX;
Log(Bars.GetBar(rec.StartAnchor.Time).ToString(), LogLevel.Information);
Log(Close[Bars.GetBar(rec.StartAnchor.Time)].ToString(), LogLevel.Information); <--- issue here
return;
}
}
}
}

Comment