Loading…

Common Folder Sync Helper

Every MQL4 program is normally limited to its own terminal's MQL4\Files sandbox, which is exactly right for isolation and exactly wrong the moment two or three terminals - a live account, a demo, a second broker - need to read the same watchlist, parameter file, or signal feed. The platform does provide a shared location for this, the common folder, reachable from any terminal by passing FILE_COMMON to FileOpen, but nothing in the terminal UI copies a file there for you. This script does the copy at the byte level rather than trusting FileCopy's combined flag argument to apply the common-folder distinction to the right side of a two-sided operation. FileOpen's own FILE_COMMON flag is unambiguous - it always describes the handle it is opening - so the script opens the source with one flag, reads it whole, opens the destination with the other, and writes it back. Slower than a native copy for a very large file, and irrelevant for the sizes this is meant for: watchlists, INI-style settings, small CSV feeds. A list of files can be synced in one run, and each file's result is reported individually - a batch of ten files where one is missing should not look like a single opaque failure, it should say which nine copied and which one did not and why. Notes and limitations - The whole file is read into memory before anything is written, so this is meant for the kind of small, structured files terminals actually share - watchlists, settings, CSV feeds - not multi-gigabyte history dumps. - Verification checks size only, not content. A destination that was overwritten by something else in between the write and the check, at exactly the same size, would not be caught. - The common folder is genuinely shared machine-wide. A file synced there is readable and overwritable by any terminal running under the same Windows user account, not just the ones installed for this broker. - Subfolders are not created automatically - a file name that includes a path segment fails if that folder does not already exist on the destination side.

Script · MT5 · v1.0 · Free

About Common Folder Sync Helper

Common Folder Sync Helper is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as File list, Direction and Overwrite. MQL source code included.

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

Settings

SettingDefaultWhat it does
File listSemicolon-separated file names to sync
DirectionSYNC_TO_COMMONCopy direction
OverwritetrueOverwrite the destination if it already exists
Verify size aftertrueRe-check the destination size matches the source

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: Buy/Sell Arrows · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria