Loading…

Pipeline Conductor

Running a record step, then an analysis step, then a report step in the right order, on a schedule, without babysitting it by hand is a plumbing problem, not a trading problem - but MQL4 has no way to directly launch another EA or process. This conductor solves it the way file-driven tools in this catalogue already talk to each other: each stage is defined by a request file this EA writes and a done file it waits for, written back by whatever actually performs that stage (another EA, a script, an external process watching MQL4\Files\ (or MQL5\Files\ on the native MQL5 build), or a human). A stage is only considered successful once its done file appears and its content does not start with "FAIL" - an empty or "OK" done file counts as success; "FAIL,<reason>" aborts the run at that stage rather than letting a report stage run against analysis output that never actually finished. Each stage also carries its own timeout: a stage worker that never responds stops the pipeline rather than hanging forever or letting a later stage start on stale or missing input. Every stage's start, success/failure, and the whole run's outcome are appended to a log file with a shared run ID, so a failed pipeline can be diagnosed from the log alone - which stage ran, how long it took, and exactly what it reported. Runs start either from a manual trigger file dropped into MQL4\Files\ (or MQL5\Files\ on the native MQL5 build), or automatically once a day at a configured server-time. Notes and limitations - This EA performs no stage's actual work itself - Record, Analyse and Report are placeholders for whatever real tools you point the request and done files at. It only sequences and checks them. - Only one pipeline run can be active at a time; a manual trigger or the daily schedule firing while a run is already in progress is simply ignored until that run finishes or times out. - Stage success detection reads only the first line of the done file - a multi-line report from a stage worker should still put its OK/FAIL,<reason> status on the first line. - The daily schedule fires once per calendar day the first time server time reaches or passes InpScheduleTime; restarting the EA after that time on the same day will not re-fire it until the following day. - A stage worker that writes its done file before ever seeing the matching request file (a race at very short timeouts) would be misread as an immediate success - this conductor deletes any leftover done file before writing a fresh request specifically to guard against a previous run's stale done file causing that, but a same-tick race with a very fast, badly-timed worker is still theoretically possible.

Expert advisor · MT5 · v1.0 · Free

About Pipeline Conductor

Pipeline Conductor is a script for MetaTrader 5. It has 4 settings, such as Trigger file, Schedule time and Log file. MQL source code included.

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

Settings

SettingDefaultWhat it does
Trigger filepipeline_run.flagCreate this file to start a run immediately
Schedule time"HH:MM" server time for a daily automatic run; blank = manual only
Log filepipeline_run_log.csvAppend-only per-stage run history
Poll seconds5Seconds between stage/trigger checks

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: MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria