Batch Restyle Objects By Prefix
Restyling twenty hand-drawn trend lines one at a time in the object properties dialog is slow and error-prone - it is easy to miss one or apply a slightly different colour by mistake. This script applies the same colour, width and style to every object matching a prefix in a single pass, and reports exactly how many objects it touched. The naive version of this idea applies every property to every object regardless of type, which either silently no-ops or produces confusing results - line width means nothing on a text label, and colour on a filled shape is a different visual effect than colour on a line. This script checks each property against the object's actual type before applying it, so the summary line reports what genuinely changed rather than a count that includes properties that were quietly ignored. Notes and limitations Width and style are skipped on object types that do not support them (arrows, text, labels for width; filled shapes and markers for style) - the summary counts reflect this, so a lower "applied" count than "matched" is expected and correct, not a bug. Matching is a plain prefix test (StringFind at position 0), not a wildcard or regex. Does not touch objects on other open charts.
Script · MT4 · v1.0 · Free
About Batch Restyle Objects By Prefix
Batch Restyle Objects By Prefix is a script for MetaTrader 4. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Prefix, Change color and New color. MQL source code included.
Files in the download: BatchRestyleObjects.mq4, BatchRestyleObjects.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Prefix | Object name prefix to restyle (case-sensitive, required) | |
| Change color | true | Apply the new colour |
| New color | clrDodgerBlue | New colour |
| Change width | true | Apply the new line width |
| New width | 2 | New line width (1-5) |
| Change style | false | Apply the new line style |
| New style | STYLE_SOLID | New line style |
| Confirm first | true | Ask for confirmation before applying |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trend · Buy/Sell Arrows · Alerts · MT4 Script · MQL4 Source Code