Creation a script for MT 5  - Instantly delete all objects
_________________________________________________________
Taken from the mql4 forum

Today we are going to create a simple script for Metatrader 5 that will instantly delete all objects on the active chart window. If you are experimenting with graphical objects or if you are using indicators that do not redraw graphical objects automatically, the script will save your time.



First, open MetaEditor 5 and press the "New" button. The MQL5 Wizard will start up. Select "Script" and press "Next":




















All pictures are clickable!
Now give a name to your script and fill your copyright information - author and website, then press "Next":

A window with the code for your script will appear. Our script is probably the easiest one, because it contains only one line of code. Add this line of code as shown on the picture:


ObjectsDeleteAll(0);
//---


Now press the "Compile" button and make sure that no errors appear in the debugging window below:
The script is saved in your Scripts folder. Now open Metatrader 5 terminal and add some graphical objects to the chart.
Now open the navigator window, select your script and drag it to the chart window. All graphical objects will instantly disappear.

It's much faster than doing it by hand, isn't it?

As you can read in the MQL5 reference guide, the ObjectsDeleteAll function removes all objects from the specified chart. You can also specify such variables as chart id, type of object that will be removed, etc. In our case "0" means the current chart. If you want to learn more about this function, search for "ObjectsDeleteAll" in the MQL5 reference guide.


Subscribe to updates via email:

Enter your email address:



                 
Subscribe  to  fx1618 via RSS
Subscribe to fx1618 by Email
                What is RSS???

    


________________________________________________________________________________________________________________________
Home