Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

ToClearChartObjectsByType - MetaTrader 5 Script - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

The script removes from the current chart all objects of the type selected by the trader in the input parameters.

 //+--------------------------------------------------------+
//| Script input parameters |
//+--------------------------------------------------------+
Input ENUM_OBJECT object type = - 1 ; //Object type to be deleted

When used with the default parameters, the script will remove all objects from the current chart.

If you frequently need to delete objects of a fixed type, you should script a copy of the object with the appropriate type ID specified as an input variable. For example, here is a script for removing trend lines by clearing the chart object via OBJ_TREND :


Attachment download

📎 toclearchartobjectsbytype.mq5 (2.72 KB)

📎 toclearchartobjectsbyobj_trend.mq5 (2.7 KB)

Source: MQL5 #17996

Verification code Refresh