The client's idea
Navid Pakzad works EURUSD / GBPUSD on M5; the opening brief was: In busy hours my orders fill at bad prices — fix that.
Project and starting point
The expert sent orders with no slippage ceiling, and in busy hours they filled several pips worse.
Solution architecture
A slippage ceiling, a spread check before sending, bounded retries on rejection, and full logging of the gap between requested and filled price.
Retries are bounded so a fast market does not turn them into extra cost. It matches how EURUSD / GBPUSD is actually traded and can be tested against the data already available.
Why this design
Retries are bounded so a fast market does not turn them into extra cost. It matches how EURUSD / GBPUSD is actually traded and can be tested against the data already available.
Implemented capabilities
Modules and components built: Slippage cap + smart retry.
Delivered output:
Fixing order slippage in an expert — EURUSD / GBPUSD (M5)
Specification document and the rule-to-code mapping table
Full MQL4 source, commented
Test report: Busy-hour testing
Parameter document and install guide (4 weeks)
Safeguards and risk control
Every change starts from a saved backup, and the previous behaviour is kept as the test reference.
Backtest and forward test method
Test method: Busy-hour testing.
Testing runs in three stages: a backtest on historical data, limited optimisation inside the contract's scope, and a forward run with the parameters frozen.
Tools and stack: MQL4, order logs, M5 data for two pairs.
Every figure from this project is published together with its measurement conditions: the data window, the tick model, the spread, the commission and the build of the executable. Without them a number cannot be compared with anything.
Publishable results
The logged gap between requested and filled price came in under half a pip after the change.
Limitations and cautions
Every change starts from a saved backup, and the previous behaviour is kept as the test reference.
Every test result depends on the quality of the historical data, the broker's spread and market conditions, and none of it is a promise about the future. Through a severe price gap or a broker disconnection a stop loss cannot be guaranteed, so behaviour in those conditions must be reviewed separately.
Our next-step proposal
The next step is a full technical review of the expert and clearing the old code's debts.
Portfolio
Measured results
These are the figures the test produced — not a promise about future performance.
- 0.5 pip Average execution slippage
- 4 Defects fixed
- 40 ms Order round-trip time
- 99.9 % Runtime stability in test