Loading…

Open Signal Format Bridge

Most file-based bridges use an ad-hoc CSV layout the third party has to reverse engineer from a forum post or the source code itself, and most of them forget everything they knew the moment the EA restarts, so a webhook receiver or dashboard that already sent a trade has no way to know whether it needs to send it again. This project exists to remove both problems. The file layout is versioned and documented in the source header under "OPEN SIGNAL FORMAT v1" - one line format for the export snapshot (current open trades, symbol, lots, prices, stop/target, open time, magic, comment) and one line format for the import file (OPEN and CLOSE action lines). A third party never needs to open this .mq4 file to integrate with it. Every OPEN import line carries an externalId chosen entirely by the third party - this bridge never invents one. Before applying an OPEN line, the bridge checks a persisted externalId-to-ticket mapping file; if that externalId was already applied, the line is a silent no-op. That mapping is written to disk the moment a trade opens and reloaded at EA startup, so a third party can safely re-send the same OPEN line after a terminal restart, a dropped connection, or simple uncertainty about whether the first send was received, without ever risking a duplicate trade. Notes and limitations - Up to 500 externalId-to-ticket mappings are held in memory (a fixed-size cap, chosen for simple, safe array handling in native MQL4). Beyond that, new mappings are still written to the persistence file but are not held in memory for the remainder of that run, so a duplicate OPEN re-send for one of those older ids is not guaranteed to be caught until the next restart reloads the full file. - A CLOSE line can only close a ticket this bridge itself opened and mapped - it has no way to close a position it never issued an externalId for, even if that position happens to share this EA's magic number. - The import file is read as an append-only log and never truncated by this bridge. Left running indefinitely, the file grows without bound; operators should rotate or archive it during a maintenance window when the EA is not running, not while it is actively reading it. - Export snapshots only include orders carrying this EA's own magic number - a manually opened or foreign-magic position never appears in the export file, and is invisible to the third party reading it.

Expert advisor · MT5 · v1.0 · Free

About Open Signal Format Bridge

Open Signal Format Bridge is an expert advisor (trading robot) for MetaTrader 5. It has 8 settings, such as Export file name, Import file name and Mapping file name. MQL source code included.

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

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Export file nameopen_signal_format_export.csvFile in MQL5\Files\ - this account's own open positions, rewritten every export
Import file nameopen_signal_format_import.csvFile in MQL5\Files\ - third-party requested opens/closes, appended by them
Mapping file nameopen_signal_format_mapping.csvFile in MQL5\Files\ - persists externalId -> ticket across restarts
Magic number46900Magic number stamped on orders this bridge opens
Slippage points30Maximum acceptable slippage, in points
Export interval sec3Seconds between export snapshot rewrites
Import interval sec2Seconds between import file checks
Allow import closetrueAllow an import line with ACTION=CLOSE to close a previously bridge-opened trade

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 → Experts.
  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 expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Dashboards & Scanners · Buy/Sell Arrows · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria