Download MetaTrader 5

Undo created object?

To add comments, please log in or register
Nikolay 2016.05.06 18: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!

Nikolay 2016.05.10 22: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?

Keith Watford
Keith Watford 2016.05.10 22:32  
I've never had reason to use it, but you could loop through the objects and find the last using


Nikolay 2016.05.11 12:24  
oh, great! Somehow I missed that property! Thanks :)
To add comments, please log in or register