Loading…

External Data Import Daemon

External data - a scraper's output, a broker's export, a manually saved spreadsheet - rarely arrives in a consistent format, and hand-checking every drop before using it does not scale. This EA watches a drop folder for '*.csv' files, and for each one validates every row (a parseable date, a parseable numeric value, strictly non-decreasing date order within the file) before appending it to a normalised 'Date,Value,ImportedAt,SourceFile' store file named after the series - a malformed row is skipped and counted, never allowed to silently corrupt the running store or crash the import partway through. Successfully processed drops are moved to an archive subfolder rather than deleted, so a raw source file remains available if an import ever needs a manual re-check. Honest limitation, stated plainly rather than implied away: MQL4's file functions are sandboxed to MQL4\Files (and MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)Common with FILE_COMMON) and cannot write into the terminal's actual history\<server>\ offline-chart folder - no MQL4 program can install its own output as real chart history. This daemon imports into its own sandboxed store for other tools (indicators, scripts, external readers) to read, not into the terminal's chart history; getting data into a chart as real offline history remains a separate, manual step outside any MQL4 program's reach. Notes and limitations This tool never writes into the terminal's real chart history folder - see the honesty note above. It produces a clean, appendable CSV series store inside the sandbox for other tools to consume, which is a materially different (and achievable) goal from "auto-import as offline chart history." The series name is derived from the dropped filename, not from any header inside the file - two files with the same prefix before their first underscore append to the same store, which is the intended behaviour for periodic drops of the same series but means a filename typo silently creates a new, separate series rather than erroring. Out-of-order rows within a single drop are skipped rather than sorted, keeping the store append-only and simple; a source that cannot guarantee ascending date order should be pre-sorted before dropping.

Expert advisor · MT4 · v1.0 · Free

About External Data Import Daemon

External Data Import Daemon is a script for MetaTrader 4. It has 6 settings, such as Drop folder, Store folder and Archive folder. MQL source code included.

Files in the download: ExternalDataImportDaemon.ex4, ExternalDataImportDaemon.mq4, ExternalDataImportDaemon.txt.

Settings

SettingDefaultWhat it does
Drop folderExternalDataImportDaemon\\InboxSubfolder of MQL4\Files scanned for *.csv drops
Store folderExternalDataImportDaemon\\StoreSubfolder where normalised '<Series>.csv' files accumulate
Archive folderExternalDataImportDaemon\\ArchiveWhere successfully-imported source files are moved
Scan interval seconds5
Csv delimiter,Delimiter expected in dropped files - first char only is used
Max rows per file100000Safety cap against an unbounded/corrupt drop

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: MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria