Loading…

Set Symbol On All Charts

Rebuilding a whole layout around a different instrument - moving a set of M5/M15/H1/H4 charts from one pair to another - is normally one symbol-box edit per chart, and it is easy to leave one behind. This script switches every open chart to the given symbol in one pass, and deliberately leaves each chart's own timeframe untouched, so an M5 chart stays M5 on the new symbol rather than all charts collapsing onto whatever period happened to be current. The symbol name is checked against the broker's full symbol list before a single chart is touched. A typo'd name would otherwise queue a change on every open chart that quietly fails on each one, and there would be nothing in that failure to point at the name itself as the cause. Checking first and refusing cleanly, with nothing touched, is worth the extra call. If the symbol exists but is not yet in Market Watch, it is added automatically - a chart cannot show live quotes for a symbol with no subscription, so skipping that step would just move the failure one call later. ChartSetSymbolPeriod carries the same two traps here as in SetTimeframeAll and ApplyTemplateAll. It is asynchronous, so a true return means the switch was queued, not completed - the per-chart result is worded as "queued" for that reason. And changing a chart's symbol re-initialises whatever is running on it, including this script if it is applied to its own chart first. Every other chart is processed and reported before the script's own chart is touched, as the very last action. Notes and limitations - A "queued" result is not proof the symbol actually changed - it only means the chart accepted the request. - The chart running this script is always done last, even if its natural position in the chart list would put it earlier. - Symbol names are exact strings, including broker suffixes such as .m or -ECN. The validation check is an exact match against the broker's full symbol list, not a fuzzy or case-insensitive search. - Adding a symbol to Market Watch here does not remove it afterwards; that matches the platform's own behaviour and is noted in the journal when it happens. - An Expert Advisor running on a chart that gets switched is re-initialised with the new symbol, which is very likely not what that EA was configured to trade. Be deliberate about which charts are included. - The chart walk is capped at 200 charts as a defensive limit.

Script · MT5 · v1.0 · Free

About Set Symbol On All Charts

Set Symbol On All Charts is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Symbol and Confirm first. MQL source code included.

Files in the download: SetSymbolAll.ex5, SetSymbolAll.mq5, SetSymbolAll.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to switch every chart to (required)
Confirm firsttrueAsk for confirmation before switching

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria