The article presents a modular pre-trade execution filter for MQL5 as an object-oriented include class. It validates quote freshness, aligns order filling with broker capabilities, applies a rollover freeze window, and detects spread outliers using rolling statistics with a hard cap. An on-chart diagnostic indicator and an EA template with reproducible telemetry show integration and help reduce execution frictions in live trading.
Strategy developers often attribute live underperformance to parameter overfitting or regime shifts. However, post-trade transaction cost analysis (TCA) often shows that pre-trade execution friction is equally important.
Standard Strategy Tester simulations operate within deterministic and controlled environments. Even with variable spread modeling on real tick data, the tester still assumes continuous market depth, instantaneous order processing, and regular quote arrival. In live institutional and retail trading environments, conversely, order routing is subject to liquidity fragmentation, broker clearing and settlement procedures, and network transit delays.
During end-of-day bank rollovers, high-impact macroeconomic data releases, and session transits, bid/ask spreads widen substantially and quote delivery intervals fluctuate. An Expert Advisor executing market orders during these friction intervals absorbs immediate adverse slippage, increasing transaction drag and causing premature stop-loss executions.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Building a Modular Pre-Trade Execution Filter Engine in MQL5.
Strategy developers often attribute live underperformance to parameter overfitting or regime shifts. However, post-trade transaction cost analysis (TCA) often shows that pre-trade execution friction is equally important.
Standard Strategy Tester simulations operate within deterministic and controlled environments. Even with variable spread modeling on real tick data, the tester still assumes continuous market depth, instantaneous order processing, and regular quote arrival. In live institutional and retail trading environments, conversely, order routing is subject to liquidity fragmentation, broker clearing and settlement procedures, and network transit delays.
During end-of-day bank rollovers, high-impact macroeconomic data releases, and session transits, bid/ask spreads widen substantially and quote delivery intervals fluctuate. An Expert Advisor executing market orders during these friction intervals absorbs immediate adverse slippage, increasing transaction drag and causing premature stop-loss executions.
Author: Amanda Vitoria De Paula Pereira