This tool is designed as a cleanup utility for your trading charts, specifically intended to manage and organize visual markers on your workspace. If you frequently use automated systems or manual tools that place various labels, lines, or indicators on your screen, this script allows you to instantly clear specific categories of objects without affecting everything else.
How it Works
The core logic of the script is based on "naming conventions." Every object placed on a MetaTrader chart (such as an arrow, a line, or a text label) has a unique internal name. This script looks for objects that begin with a specific prefix defined by you.
Key Functionalities:
- Targeted Removal: Rather than deleting every single item on your chart—which could remove important manual drawings or other necessary tools—the script specifically targets items that share a common naming pattern.
- Customizable Filtering: Through the "Index" setting, you can specify which group of objects to clear. By changing this number, you can distinguish between different types of markers (for example, deleting all "Wave Markers" while keeping your "Trend Lines" intact).
- Automated Scanning: The script automatically scans every object currently active on your visible chart. It checks the name of each item one by one; if the name matches your specified criteria, the script removes it from the screen immediately.
Use Case
This is particularly useful for traders who use "Wave" indicators or repetitive marking tools. Instead of manually clicking and deleting dozens of markers one by one after a trade is closed or a market structure changes, you can run this script to wipe the slate clean in a single click, keeping your chart organized and professional.
//+------------------------------------------------------------------+
//| s_WaveMarker_DeleteAll.mq4 |
//| * |
//| * |
//+------------------------------------------------------------------+
#property copyright "Integer"
#property link "for-good-letters@yandex.ru"
#property show_inputs
extern int Index = 0;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
for(int i = ObjectsTotal() - 1; i >= 0; i--)
{
if(StringFind(ObjectName(i), "WM(" + Index, 0) == 0)
{
ObjectDelete(ObjectName(i));
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments