Slippage Setting Simulator
The slippage/deviation argument on a market order is one of the most misunderstood parameters in MetaTrader. It is not "how likely is this to fill" and it is not "how much extra I am willing to pay" in the sense most people read it - it is the largest adverse price movement, in points, that the server will accept before requoting instead of filling. Two brokers, or even the same broker at two different times of day, can apply that ceiling differently, and no amount of reading forum threads substitutes for sending a real order and seeing what comes back. This script runs a short series of market orders, one per slippage value in a configurable list, at the smallest lot size the symbol allows, and records the requested price, the price actually filled, the difference between them in points, and whether the order was filled, rejected, or requoted. Each test order is closed immediately by default, so exposure to the market is measured in seconds, not until someone remembers to close it manually. Because this genuinely sends orders and genuinely risks money, it refuses to run at all unless the connected account reports itself as a demo account, and asks for an explicit confirmation naming exactly how many orders it is about to send before doing anything. Both checks can be switched off, because a script cannot see every legitimate use of its own inputs, but the defaults assume the answer is no. Notes and limitations - This sends real orders on whatever account is connected. The demo-account check is a safeguard, not a substitute for reading what it does before running it. - Results reflect market conditions, spread and broker behaviour at the moment each test ran; slippage behaviour can and does vary by time of day, news events and overall liquidity, so a single run is a sample, not a permanent characterisation of the broker. - A rejected or requoted order is reported as such, not retried - retrying automatically would defeat the point of measuring what actually happened at each slippage setting. - Lot size, price and stop distances are all read from the symbol's own live specification at runtime; nothing about contract size or tick value is assumed or hardcoded. - FIFO or hedging restrictions on some accounts can affect whether a sequence of quick open/close pairs on the same symbol behaves exactly as described; the log shows the true outcome of every attempt either way. - The MQL5 version refuses to run on a netting account with a pre-existing position on the test symbol, as explained above - this is intentional, not a bug.
Script · MT4 · v1.0 · Free
About Slippage Setting Simulator
Slippage Setting Simulator is an expert advisor (trading robot) for MetaTrader 4. It has 7 settings, such as Direction, Lots override and Close immediately. MQL source code included.
Files in the download: SlippageSettingSimulator.ex4, SlippageSettingSimulator.mq4, SlippageSettingSimulator.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 |
|---|---|---|
| Direction | DIR_BUY | Order direction used for every test |
| Lots override | 0.0 | Lot size (0 = use the symbol's minimum lot) |
| Close immediately | true | Close each test order right after it opens |
| Magic number | 990197 | Magic number tagging every test order |
| Require demo account | true | Refuse to run unless this is a demo account |
| Confirm first | true | Ask for confirmation before sending real orders |
| Write csv report | true | Write the results to MQL4\Files as CSV |
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: MT4 Script · MQL4 Source Code