Loading…

Save All Chart Templates

Read the name literally before installing this: it does not export a list of your existing templates. The terminal's real Templates folder lives outside the sandbox, and neither MQL4 nor MQL5 has a function that lists files in it. A script running inside the sandbox simply cannot see what is already saved there. That is a platform limitation, not an oversight in this script, and any submission that claims otherwise is not being honest about what the platform can do. What this script can do, and does, is save a new template for every chart open in the terminal at the moment you run it - one file per chart, named after the chart's symbol, timeframe and the time it was saved. Run it before closing the terminal for the day, or before making a change you might want to undo, and you get a dated snapshot of every layout, indicator set and EA attachment across all your open charts in one click. The other trap is where the file ends up. ChartSaveTemplate() writes to the terminal's Profiles\Templates folder by default, which is outside the sandbox - a script cannot read that folder back, and a template saved there does not travel with the rest of the sandbox if you back up or move MQL4\Files. MQL4 has a documented special case for this: passing a filename that starts with "\Files\" redirects the save into MQL4\Files instead of the templates directory. This script always uses that prefix, so every file it produces lands in the sandbox, in one place, ready to be copied, zipped or picked up by another sandboxed script. Notes and limitations - Cannot list, browse or read back existing templates, from the sandbox or the terminal's Templates folder. It only creates new files. - Covers only charts open in the terminal at the moment it runs. A chart you did not have open is not represented. - A saved template captures a chart's indicators and any attached Expert Advisor the same way any normal MetaTrader template save does - inputs that exist only in the EA's memory and were never applied to the chart are not part of that data and are not captured here either. - Filenames use the symbol exactly as the broker names it. A broker suffix such as ".m" or "-ecn" carries through into the filename unchanged. - If two charts share the same symbol and timeframe and the script is run twice within the same second, the second save can overwrite the first - the timestamp only has one-second resolution. - To use a saved file as a template again, move or copy it out of MQL4\Files into the terminal's Profiles\Templates folder first; the terminal's own Template menu does not look inside MQL4\Files.

Script · MT5 · v1.0 · Free

About Save All Chart Templates

Save All Chart Templates is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 1 setting, such as Filename prefix. MQL source code included.

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

Settings

SettingDefaultWhat it does
Filename prefixOptional prefix added to every saved filename

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