1. draw an object at each new bar
2. then delete these objects except the last 5
3. Modify the opacity and color of the 4 objects
we do nothing for the draw object on CurrentBar
in this link https://ninjatrader.com/fr/support/h...rawobjects.htm
there is this line which allows to modify the color of the object in black
globalLine.Stroke.Brush = Brushes.Black;
my question
is there a solution that allows to modify the opavity, color, width... of the object by its TAG like RemoveDrawObject("tag_" + (CurrentBar-5));
Thanks in advance
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
Draw.VerticalLine(this, "tag_" + Convert.ToString(CurrentBars[0]), 0, Brushes.Lime, DashStyleHelper.Solid, 2);
RemoveDrawObject("tag_" + (CurrentBar-5));
foreach (DrawingTool draw in DrawObjects.ToList())
{
if (draw is DrawingTools.Line)
{
DrawingTools.Line globalLine = draw as DrawingTools.Line;
globalLine.Stroke.Brush = Brushes.Black;
}
}
}

Comment