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 · MT4 · v1.0 · Free
About Open Signal Format Bridge
Open Signal Format Bridge is an expert advisor (trading robot) for MetaTrader 4. 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.ex4, OpenSignalFormatBridge.mq4, OpenSignalFormatBridge.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Export file name | open_signal_format_export.csv | File in MQL4\Files\ - this account's own open orders, rewritten every export |
| Import file name | open_signal_format_import.csv | File in MQL4\Files\ - third-party requested opens/closes, appended by them |
| Mapping file name | open_signal_format_mapping.csv | File in MQL4\Files\ - persists externalId -> ticket across restarts |
| Magic number | 46900 | Magic number stamped on orders this bridge opens |
| Slippage points | 30 | Maximum acceptable slippage, in points |
| Export interval sec | 3 | Seconds between export snapshot rewrites |
| Import interval sec | 2 | Seconds between import file checks |
| Allow import close | true | Allow an import line with ACTION=CLOSE to close a previously bridge-opened trade |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Dashboards & Scanners · Buy/Sell Arrows · MT4 Expert Advisor · MQL4 Source Code