The client's idea
Kaveh Mehrabi works XAUUSD on M1; the opening brief was: Before any decision, tell me how trustworthy my backtest data actually is.
Project and starting point
The gold backtest had been built on incomplete data: hourly gaps and duplicate candles flattered the statistics.
Solution architecture
A quality script counting gaps, incomplete and duplicate candles, comparing two sources and reporting before any backtest runs.
The data check now runs before the backtest so no result is built on suspect data. It matches how XAUUSD is actually traded and can be tested against the data already available.
Why this design
The data check now runs before the backtest so no result is built on suspect data. It matches how XAUUSD is actually traded and can be tested against the data already available.
Implemented capabilities
Modules and components built: Gap report + missing-hour detection.
Delivered output:
Tick data validation — XAUUSD (M1)
Specification document and the rule-to-code mapping table
Full MQL5/Python source, commented
Test report: Two data sources compared
Parameter document and install guide (6 weeks)
Safeguards and risk control
No parameter was optimized on the whole set: part of the data was held back for out-of-sample testing.
Backtest and forward test method
Test method: Two data sources compared.
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: MQL5, Python scripts, data from two sources.
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
After cleanup the gold backtest came out more conservative, and the client shortened the window to three years to keep the data complete.
Limitations and cautions
No parameter was optimized on the whole set: part of the data was held back for out-of-sample testing.
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 running the selected build on demo and reviewing weekly deviation from the test.
Portfolio
Measured results
These are the figures the test produced — not a promise about future performance.
- 2.4 M Bars in the test set
- 11 scenarios Scenario test coverage
- 3 years Test window
- 6 Defects fixed