Undo created object?

Back to topics list To post a new topic, please log in or register
nikolaygmt 2016.05.06 20:02

How can I undo creating an object (HL, VL, Trendline) after pressing a button to create it? (not by calling ObjectCreate, so I do not have the object name)

My current thoughts and questions:

  1. There is a menu "Charts->Objects->Delete Last", but it has no effect after a) I draw a HL and chose it or b) if I choose two HLs and chose it. How does it work?
  2. MT4 gives those objects names in the following format <OBJ_NAME> <OBJ_NUMBER>, e.g. "Horizontal Line 55790". This number seems to increase after every object I create by pressing a button. Is that correct?
  3. If 2) is correct, maybe I could write a function that searches all object with the above mentioned format, finds the one with the highest number and deletes it. Do you see any potential issues and has anybody already done that?

Thank you!

nikolaygmt 2016.05.11 00:22 #

if the chart is fresh, then the number get higher and higher as objects are created, but if the chart is old/reopened (I do not know when exactly) the numbers of the newly created objects may be lower than the current highest number.

So 2) is not exactly correct ...

Does anybody know how the last created object can be identified at anytime working with the chart?

GumRai 2016.05.11 00:32 #
I've never had reason to use it, but you could loop through the objects and find the last using


nikolaygmt 2016.05.11 14:24 #
oh, great! Somehow I missed that property! Thanks :)
Back to topics list  

To add comments, please log in or register