PK Tech Solutions

MT5 Execution Delay: How to Stress-Test Gold EAs Under Realistic Trading Conditions

PK Tech Solutions

What is execution delay?

Execution delay is the time between a trade request and its execution. In a simplified model, t₁ = t₀ + τ, where τ is the delay. Price may move favorably or adversely during this interval.

The model describes request timing, not a guarantee of a fill at t₁. A request may be rejected or requoted depending on execution mode and permitted deviation.

Three tester modes

No Delay provides an idealized baseline. Fixed Delay measures sensitivity to a specified delay; measured ping can inform the setting but is not total execution latency. Random Delay explores variable delays.

Random Delay mathematics

The documented algorithm draws an integer 0–9; if it draws 9, it adds another integer 0–9. Assuming uniform draws, 0–8 seconds has probability 90% and 9–18 seconds has probability 10%. E(τ) = 0.9 × 4 + 0.1 × 13.5 = 4.95 seconds. This is a model expectation, not measured broker latency.

Conceptual request-to-execution timeline and random delay probabilities
Conceptual model, not measured latency.

Delay versus slippage

Delay measures time; slippage measures price difference. Liquidity, volatility and execution policies can also affect fills. A price difference alone does not establish its cause.

Controlled stress test

Illustrative targets: No Delay, 50, 100, 250, 500 and 1,000 ms, plus Random Delay. Use the nearest supported setting if unavailable. Keep EA version, inputs, symbol, timeframe, dates, tick mode, deposit, leverage, costs and contract specifications fixed. Repeat random tests without assuming independent samples.

Open Strategy Tester, disable optimization, choose one historical period and run the No Delay baseline first. Change only delay for each subsequent run. Save the report and Journal with the actual delay setting, terminal build and broker symbol. Repeat on a separate market period without retuning inputs.

Measuring sensitivity

For a positive baseline, R(τ) = P(τ)/P(0) × 100%. At 250 ms, R = 350/500 × 100% = 70%, a 30% reduction. Do not use this ratio with a zero or negative baseline. All figures below are hypothetical, not actual product results.

DelayNet profitMax equity DD
0 ms500 USD8%
100 ms450 USD9%
250 ms350 USD12%
500 ms200 USD18%
1000 ms-100 USD25%

Metrics

Review net profit, maximum equity drawdown, profit factor, recovery factor, executed trades, failed requests and variation between runs.

Compare the first divergent trade and request timestamps where available. Record the range of repeated results rather than treating one profitable run as proof.

Limitations

Delay applies to EA trade requests, including pending placement and protective-level modifications, not the same network delay for server-side activation of existing pending orders. Simulation cannot guarantee live liquidity, rejection behavior or costs. Use out-of-sample and demo validation.

MQL5 Sleep advances simulated tester time; it is not a substitute for the execution-delay setting.

FAQ

Best delay? No universal value. Is No Delay useful? Yes, as a baseline. Is Random Delay better? Neither mode is universally superior. Does delay guarantee realistic slippage? No.

Conclusion

Controlled latency experiments help investigate robustness, not guarantee profits. PK Tech Solutions emphasizes engineering, mathematics and risk awareness.

Related reading: Real Ticks · Slippage ·

References

AI-assisted educational article. Trading involves risk; no guarantee of returns or endorsement by MetaQuotes. Examples are hypothetical.