MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Object functions  ObjectsDeleteAll

 
int ObjectsDeleteAll( int window=EMPTY, int type=EMPTY)
Removes all objects of the specified type and in the specified sub-window of the chart. The function returns the count of removed objects. To get the detailed error information, one has to call the GetLastError() function.
Notes: The chart sub-windows (if there are sub-windows with indicators in the chart) are numbered starting from 1. The chart main window always exists and has the 0 index. If the window index is missing or it has the value of -1, the objects will be removed from the entire chart.
If the type value equals to -1 or this parameter is missing, all objects will be removed from the specified sub-window.
Parameters:
window   -   Optional parameter. Index of the window in which the objects will be deleted. Must exceed or equal to -1 (EMPTY, the default value) and be less than WindowsTotal().
type   -   Optional parameter. An object type to be deleted. It can be any of the Object type enumeration values or EMPTY constant to delete all objects with any types.
Sample:
  ObjectsDeleteAll(2, OBJ_HLINE); // all horizontal lines are removed from the 2nd sub-window.
  ObjectsDeleteAll(2);            // all objects are removed from the 2nd sub-window.
  ObjectsDeleteAll();             // all objects are removed from the chart.