Loading…

Open A Chart Per Watchlist Symbol

Building a chart layout by hand from a long Market Watch list is repetitive: right-click, New Chart, pick the symbol, set the timeframe, repeat for every pair and instrument you follow. This script does that in one pass, using whichever symbols are currently selected in Market Watch as the list. The trap in the naive version of this script is what happens on the second run. A script that simply loops the watchlist and calls ChartOpen() for every symbol every time will open a second, third and fourth chart for a symbol that already has one, because ChartOpen() does not check for an existing chart on its own. Run it a few times over a session and the terminal fills with duplicate windows for the same symbol and timeframe, which is worse than not having the tool at all. This script checks first. Before opening anything for a symbol, it walks the terminal's existing chart list with ChartFirst() and ChartNext(), comparing both the symbol and the timeframe of each open chart against the one it is about to create. A match on both means the chart already exists, so the symbol is skipped and reported as already open rather than duplicated. Only symbols with no matching chart are opened, which makes the script safe to run again later to pick up symbols added to Market Watch since the last run. A hard cap, InpMaxCharts, limits how many new charts a single run will open, because a large watchlist run without limit can open dozens of windows in a few seconds and make the terminal unresponsive while it catches up. Symbols that would exceed the cap are left untouched and reported as skipped, not opened. Notes and limitations - Opening dozens of charts is resource-heavy regardless of the cap - each one is a live chart window with its own history load and, if templates are applied, its own set of indicators. A cap of 20 is a starting point, not a guarantee the terminal will stay responsive on a slow machine. - Above roughly 50 selected symbols the script prints and alerts a caution before doing anything, but still proceeds - InpMaxCharts is what actually limits the run, the warning is only a heads-up. - Template application depends on the named template already existing in the terminal's templates folder. This script does not create or validate templates; if the name is wrong or the file is missing, the chart still opens but keeps its default look, and no error is raised for that specific case. - The duplicate check matches on symbol and timeframe only. A chart open on the same symbol but a different timeframe is not treated as a duplicate, and a second chart on the same symbol and timeframe will be opened if the first one is closed and the script is run again. - Market Watch symbols that fail to resolve to a tradeable name are skipped silently by SymbolName() and do not appear in the per-symbol table.

Script · MT5 · v1.0 · Free

About Open A Chart Per Watchlist Symbol

Open A Chart Per Watchlist Symbol is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Timeframe, Max charts and Template name. MQL source code included.

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

Settings

SettingDefaultWhat it does
TimeframePERIOD_H1Timeframe for each new chart
Max charts20Maximum NEW charts to open this run
Template nameTemplate to apply to new charts (blank = none)

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