PDA

View Full Version : Delete drawing objects


cls71
01-26-2008, 12:29 AM
Greetings,
I'm developing one indicator that draws lines, arrows and other objects. But I need to delete one or two of them in runtime.

Is there any function or method for deleting of drawing objects ?

Thanks very much.

cls71
01-26-2008, 01:28 AM
Ops. Sorry for the post.

RemoveDrawObject();

(I was searching in Help for "delete" and I didn't find nothing)

rcsingleton
09-26-2008, 10:05 AM
Hello.

I trying to setup code that will delete an object on the previous bar, if an object is drawn on the current bar.

Variables:
private string tagID;
private int prevCB;

..
DrawArrowDown(CurrentBar.ToString() + "Sell", 1, ff1 + TickSize, Color.Red);

..
prevCB = CurrentBar - 1;
tagID = prevCB.ToString();
RemoveDrawObject(tagID);

In the 'output' window, I see ..

Current Bar = 1614
Current Bar.ToString() = 1614
prevCB = 1613
tagID = 1613

But on the chart, its not removing the previous object. Can you see where I'm going wrong?

Regards,
R. C.

NinjaTrader_Josh
09-26-2008, 10:10 AM
Hi R.C.,

The reason is because your object's tags are not only CurrentBar. They are CurrentBar + "Sell".

You need to pass in a string that would be 1613Sell for it to find your object.

rcsingleton
09-26-2008, 11:35 AM
hi Josh,

Thanks, that did the trick!

Regards,
R. C.