Skip to content
All library documents

Measuring How Much Execution Cost a Backtested Strategy Can Absorb

Article MQL5 code base

Summary

This MQL5 utility evaluates how sensitive a trading strategy’s historical results are to assumed execution costs. It reads closing-deal records containing dates, profits, and optionally volumes, then recalculates net profit and profit factor at the chosen cost assumptions. The report estimates the per-deal breakeven cost, compares strategy edge with assumed realistic costs through a cushion measure, and shows a sensitivity curve across multiples of that cost. It also counts winning trades that would turn into losses after costs and combines these measures into a letter grade with recommendations.

The document describes configurable per-lot and fixed costs, scoring targets, and weights for the three grading dimensions. An optional helper can export trade history, and a reproducible sample is generated when the input file is absent. This makes the analysis accessible without external libraries, but the result depends on the quality of the trade records and whether the assumed costs reflect actual execution. The report assesses historical cost resilience; it does not establish future profitability or account for every execution effect.

Key ideas

  • A backtest’s apparent edge depends on the execution costs assumed in its calculations.
  • The tool estimates the cost per deal that would reduce net profit to zero.
  • It re-prices the full trade record and reports profit-factor resilience and winning trades lost to costs.
  • The composite grade depends on user-configured assumptions, tolerances, and dimension weights.
  • Historical cost sensitivity does not guarantee that future execution or returns will match the analysis.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.