I'm trying to remove a Line added by the Draw.Line using RemoveDrawObject without success.
I'm using a String object to pass the String to the Draw.Line method like this:
DateTime dt = Time[0];
string topLine = "ORHigh " + Bars.Instrument.MasterInstrument.Name + dt.Year + dt.Month + dt.Day;
Draw.Line(this, topLine, false, dtStartTime, dHighestPrice, dtNewEndTime, dHighestPrice, true, "OR");
I want the line to be remove when the next trading session begin and the OnBarUpdate calls the last bar of the previous session:
if (Bars.IsLastBarOfSession) RemoveDrawObject(topLine);
The Line is not removed. What I'm I doing wrong?
Comment