Currency Exposure Aggregator
A trader long EURUSD, long GBPUSD and short EURGBP can look hedged pair by pair while actually running a large net long US dollar position once the three legs are added together - per-symbol profit and loss never shows that, because each pair reports against its own quote currency in isolation. This EA scans every open market position on the account, splits each standard six-letter forex symbol into its base and quote ISO currency codes, and accumulates a signed running total per currency: buying one lot of EURUSD adds to EUR and subtracts an equivalent, currently-valued amount from USD; selling it does the reverse. Contract size for each symbol comes from the broker's own MODE_LOTSIZE rather than an assumed 100000, so mini and micro-lot symbols aggregate correctly alongside standard ones. The result is shown as a chart panel, one line per currency, positive (net long) in one colour and negative (net short) in another. It is a monitor only. It reads every open position on the account regardless of which EA or manual click opened it, and it never sends an order of its own - there is deliberately no magic number, because this tool reports on the whole account's exposure, not on trades it placed itself. Notes and limitations - Only open positions are counted; MQL5 pending orders live in a separate pool and are not exposure yet, matching the MQL4 version's own exclusion of pending orders. - Symbol parsing assumes the first six characters of the name are the ISO base and quote codes, which holds for standard broker naming (EURUSD, EURUSDm, EURUSD.a) but can misread a broker's non-standard symbol names. - Quote-currency amounts are valued at the current bid price, so the panel reflects present value, not the value at the time each position was opened. - This is a display tool - it does not hedge, close, or resize anything, and does not persist its readings anywhere.
Expert advisor · MT5 · v1.0 · Free
About Currency Exposure Aggregator
Currency Exposure Aggregator 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 Refresh seconds, Include non forex and Font size. MQL source code included.
Files in the download: CurrencyExposureAggregator.ex5, CurrencyExposureAggregator.mq5, CurrencyExposureAggregator.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Refresh seconds | 2 | How often the panel recalculates, in seconds |
| Include non forex | false | Include non-6-letter symbols (metals, indices, crypto) using base currency only |
| Font size | 10 | Panel font size |
| Positive color | clrLime | Text colour for a net-long currency |
| Negative color | clrTomato | Text colour for a net-short currency |
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: Hedging · EURUSD · GBPUSD · Alerts · MT5 Expert Advisor · MQL5 Source Code