Loading…

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

SettingDefaultWhat it does
PrefixObject name prefix to restyle (case-sensitive, required)
Change colortrueApply the new colour
New colorclrDodgerBlueNew colour
Change widthtrueApply the new line width
New width2New line width (1-5)
Change stylefalseApply the new line style
New styleSTYLE_SOLIDNew line style
Confirm firsttrueAsk for confirmation before applying

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Trend · Buy/Sell Arrows · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria