Object Prefix Migrator
Most object-drawing tools in this catalogue (and elsewhere) prefix their objects so cleanup never touches someone else's drawings. That convention breaks down the moment a trader wants to switch which tool "owns" a set of existing zones, lines or labels - renaming a prefix by hand across dozens of objects is slow and easy to get wrong. MQL4 has no ObjectRename() function, but ObjectSetString(chart_id, name, OBJPROP_NAME, new_name) genuinely renames an object in place on this platform - confirmed against the MQL4 reference, and notably different from MQL5, where the identical call does not reliably take effect and a delete-and-recreate copy is usually needed instead. This script uses the real MQL4 rename, not a copy. Matching object names are collected into an array before anything is renamed, then renamed by name rather than by list position, so the rename pass makes no assumption about how the object list is ordered or indexed. If the target name already exists (an object with the new prefix and the same suffix is already on the chart), that one object is skipped and reported rather than silently overwritten. Notes and limitations - If an object with the target name already exists, that one object is left under its old name and reported as skipped - it is never overwritten or merged. - InpOldPrefix and InpNewPrefix being identical is treated as nothing to do, not an error. - Matching is a plain "starts with" check on the object name, the same convention this catalogue's other prefix-based tools use; it is case-sensitive, since MQL4 object names are case-sensitive too. - This only renames chart objects. It has no effect on graphical objects belonging to indicators that recreate their own names every tick - those will simply be renamed back by the indicator on its next recalculation.
Script · MT5 · v1.0 · Free
About Object Prefix Migrator
Object Prefix Migrator is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Old prefix, New prefix and All charts. MQL source code included.
Files in the download: ObjectPrefixMigrator.ex5, ObjectPrefixMigrator.mq5, ObjectPrefixMigrator.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Old prefix | Existing prefix to migrate away from (required) | |
| New prefix | Prefix to migrate to (required) | |
| All charts | false | Apply to every open chart, not just this one |
| Confirm first | true | Ask for confirmation before renaming |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code