Back to the MQL code audit
Synthetic example · not customer work
Sample MQL5 repair diagnostic: initialization failure
This fictional case shows what a bounded 39 EUR code audit produces. It represents no client, trading result or proprietary strategy.
First evidenced failure
Initialize — Compile and Load have recorded passes.
Smallest next step
Guard the unavailable property and fail with one explicit diagnostic.
Acceptance basis
Four deterministic cases including boundary and restart behaviour.
1. Frozen evidence
- Platform
- MetaTrader 5 build 5326 / Windows / synthetic demo environment
- Program
- Fictional authorized-source Expert Advisor
- Compile
- Passed with 0 errors and 0 warnings
- Load
- Passed on a clean EURUSD H1 chart
- Initialize
- Failed immediately after reading an unavailable custom symbol property
- First journal line
- OnInit returned INIT_FAILED after the property check
Classification
The source compiles and attaches, so rewriting compile or load logic is unsupported. The first evidenced failure is initialization; the unavailable property and the immediately following INIT_FAILED result define the first controlled repair target.
2. Acceptance matrix
| Case | Input | Expected behaviour | Class |
|---|---|---|---|
| Property available | Valid property value | Initialization succeeds and logs the frozen value | Positive |
| Property unavailable | API returns no value | Initialization fails safely with one actionable message | Negative |
| Boundary value | Property equals the documented minimum | Initialization follows the explicit boundary rule | Boundary |
| Clean restart | Same inputs after terminal restart | Result and log classification remain deterministic | Regression |
3. Bounded repair plan
- Check the property call result before consuming its value.
- Define the supported fallback or explicit fail-closed branch.
- Log the terminal build, symbol and failed property once.
- Re-run the four frozen cases without changing strategy rules.