Slippage Recorder
A broker's advertised spread is not the same as what a trader actually pays, because the fill price can differ from the price quoted at the moment an order is sent. The only way to measure that gap directly is to actually send an order and compare the price requested immediately before the call against OrderOpenPrice() after it - there is no passive way to observe it, because a program that did not place the order never knows what price was requested for it. This EA does exactly that, on a timer, and logs both legs of the round trip: the open (comparing the pre-send Ask/Bid to the fill) and the immediate close (comparing the pre-send Bid/Ask to the close fill), plus the round-trip latency of each leg in milliseconds. Direction alternates between Buy and Sell on successive probes so a broker's bid/ask asymmetry does not bias the average in one direction. Because every probe is a real trade, InpEnableLiveProbing defaults to false - the EA runs, prints a clear status line, and sends nothing until that switch is turned on deliberately. Every probe order uses the symbol's minimum lot size only, so a single misconfigured input cannot scale the cost up. Notes and limitations - Every probe is a real trade at the symbol's minimum lot size. It costs real spread and, on accounts that charge it, real commission, every time it runs. - If the closing leg fails after the opening leg succeeds, the EA logs the ticket (MQL4) or position id (MQL5) and stops for that cycle rather than retrying indefinitely - check it manually and close it if it is still open. - On MQL5, a probe is skipped outright (not attempted and not queued) if the chart's symbol already carries any position when the probe timer fires - see MQL4 VERSUS MQL5 DIFFERENCES above. This is a safety behaviour, not a bug: it is what keeps every measured fill attributable to exactly one probe on a netting account. - Measured slippage reflects this account's trading-allowed state, broker, symbol and time of day only; it is not a general benchmark of the broker across all conditions. - This EA never opens a position and leaves it open. Every probe closes itself within the same call that opened it.
Expert advisor · MT4 · v1.0 · Free
About Slippage Recorder
Slippage Recorder is an expert advisor (trading robot) for MetaTrader 4. It looks for price differences (arbitrage). It has 7 settings, such as Enable live probing, Probe interval sec and Magic number. MQL source code included.
Files in the download: SlippageRecorder.ex4, SlippageRecorder.mq4, SlippageRecorder.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 |
|---|---|---|
| Enable live probing | false | Master switch - false does nothing but warn (see header) |
| Probe interval sec | 300 | Seconds between probes, minimum spacing between trades |
| Magic number | 20260202 | Magic number tagging every probe order |
| Slippage pips | 5 | Slippage tolerance passed to OrderSend/OrderClose |
| Max retries | 3 | Attempts per probe leg before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
| Csv file name | SlippageRecorder_Log.csv | Log file, in MQL4\Files |
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: Arbitrage · MT4 Expert Advisor · MQL4 Source Code