Broker Price Divergence Report
Two brokers quoting the "same" pair rarely quote identical prices. The gap is usually small and stable, but sometimes it is not - a fixed offset that widens around news, a server clock a few seconds out, or a feed that lags during fast moves. None of that is visible from either chart on its own; it only shows up when the two histories are placed side by side. This script does that placing. It reads a CSV exported from the other broker's terminal, matches each of its bars to the nearest bar in this terminal's own history, and reports the difference in open, close, and bar-open time. The time comparison matters as much as the price one: a consistent non-zero offset there means the two brokers are not opening bars at the same instant, which will silently misalign any comparison that assumes they are. Spread is treated honestly rather than guessed at. MetaTrader 4 stores no historical spread on either side of the comparison - only a live reading exists. If the loaded file happens to carry a spread column the script summarises it on its own terms; this terminal's own spread is shown separately, as the value at the moment the script ran, clearly labelled as a snapshot rather than pretended into a history it does not have. The file schema matches this catalogue's own Export OHLC script - time,open,high,low,close,tick_volume - with an optional seventh column, spread_points, for export tools that record it. A six-column file still compares price in full; only the spread summary is skipped. Notes and limitations - Comparison is only as good as the file's own accuracy - a corrupted or hand-edited export produces a misleading report with no way for this script to know. - Bars are matched to the nearest own bar within tolerance, not to an exact timestamp. A wide tolerance on a fast timeframe can match a file bar to the wrong own bar if that timeframe's bars are closely spaced. - Spread is never compared between the two histories - MetaTrader keeps none historically on either side. Only the file's own spread column, if present, is summarised, alongside this terminal's live spread as a separate snapshot. - Rows that do not match the six- or seven-column schema, or whose timestamp cannot be parsed, are skipped and counted, not guessed at. - This terminal must hold enough history to cover the file's date range, or early file bars will report as unmatched.
Script · MT5 · v1.0 · Free
About Broker Price Divergence Report
Broker Price Divergence Report is a script for MetaTrader 5 based on Divergence. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as File name, Timeframe and Max bars to compare. MQL source code included.
Files in the download: BrokerPriceDivergenceReport.ex5, BrokerPriceDivergenceReport.mq5, BrokerPriceDivergenceReport.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| File name | other_broker_ohlc.csv | File to read, from MQL5\Files |
| Timeframe | PERIOD_CURRENT | Own timeframe to compare against |
| Max bars to compare | 500 | Cap on rows read from the file |
| Time tolerance seconds | 30 | Nearest own bar must be within this many seconds |
| Export csv | true | Write the full per-bar diff table to CSV |
| Delimiter | DelimiterComma | Column separator, both files |
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: Divergence · News Trading · Alerts · MT5 Script · MQL5 Source Code