Exposure Ledger Broadcaster
Anyone running several terminals on the same machine - one per broker, one per strategy, one for manual trading alongside the automated ones - ends up needing to know the combined exposure across all of them, and there is no built-in way for one terminal to see what another is holding. This EA solves the narrow half of that problem: on a timer, it walks its own open order pool, aggregates net lots per symbol and rolls that up into a net-lots-per-currency figure using each symbol's base and quote code, then writes the whole thing as a plain CSV-style file into MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)Common\, which every terminal on the machine shares regardless of which broker or account it is logged into. A trailing heartbeat section records the server time the file was last written and a configurable staleness threshold, so a reader script or dashboard can tell a live feed from a terminal that has stopped updating rather than trusting a file that might be hours old. It writes only - reading and combining several terminals' ledger files into one dashboard is a separate tool's job, deliberately left outside this EA's scope. Notes and limitations - Writes only; it does not read or merge other terminals' ledger files. - Currency rollup is a best-effort split of the symbol name's first and last three characters and is skipped for symbols that do not follow that convention (indices, some metals suffix variants). - Net lots use each order's own lot size directly, never a hardcoded contract size, so the figures are meaningful across symbols of very different contract sizes once weighted by a reader's own logic. - The open-P/L column is informational only, read straight off the broker's own OrderProfit()/OrderSwap()/OrderCommission() at write time. - If MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)Common\ is not writable (rare permission configurations), writes fail silently into the Experts log rather than halting the EA.
Expert advisor · MT5 · v1.0 · Free
About Exposure Ledger Broadcaster
Exposure Ledger Broadcaster is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Publish interval seconds, Magic filter and File prefix. MQL source code included.
Files in the download: ExposureLedgerBroadcaster.ex5, ExposureLedgerBroadcaster.mq5, ExposureLedgerBroadcaster.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Publish interval seconds | 15 | Seconds between ledger writes |
| Magic filter | 0 | 0 = include every open position, otherwise only this magic |
| File prefix | ExposureLedger | Base filename written under Files\Common\ |
| Stale after seconds | 120 | Heartbeat age, in seconds, a reader should treat as stale |
| Include pending orders | false | true = also count pending order volume as directional exposure |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Dashboards & Scanners · Alerts · MT5 Expert Advisor · MQL5 Source Code