MetaTrader 5 MT5 Scripts ToClearObjectsByType – script MetaTrader 5

ToClearObjectsByType – script MetaTrader 5

The script removes all objects of the type selected by the trader in input parameters from all charts of the client terminal.

//+-----------------------------------------------+
//|  SCRIPT INPUT PARAMETERS                      |
//+-----------------------------------------------+
input ENUM_OBJECT OBJ_TYPE = -1;    //The type of objects to delete

When used with default parameters, the script deletes all objects from all charts of the client terminal.

If you regularly need to delete objects of a fixed type, you should write a copy of the script with the appropriate object type ID specified as an input variable. For example, here is a script for removing trend lines ToClearObjectsByOBJ_TREND:

//+-----------------------------------------------+
//|  SCRIPT INPUT PARAMETERS                      |
//+-----------------------------------------------+
ENUM_OBJECT OBJ_TYPE = OBJ_TREND;    //The type of objects to delete

A version for removing news label, which appear regularly and clutter the chart — ToClearObjectsByOBJ_EVENT:

Alternative:   Waddah_Attar_Trend_HTF - indicator MetaTrader 5
//+-----------------------------------------------+
//|  SCRIPT INPUT PARAMETERS                      |
//+-----------------------------------------------+
ENUM_OBJECT OBJ_TYPE = OBJ_EVENT;    //The type of objects to delete


📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks