Strategy testing and trading software · Germanycontact@stratcorealpha.com · DE
Back to the MQL code audit
Synthetic example · not customer work

Sample MQL5 repair diagnostic: initialization failure

This fictional case shows what a bounded written code diagnosis 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

Swipe the table sideways to read every case.

CaseInputExpected behaviourClass
Property availableValid property valueInitialization succeeds and logs the frozen valuePositive
Property unavailableAPI returns no valueInitialization fails safely with one actionable messageNegative
Boundary valueProperty equals the documented minimumInitialization follows the explicit boundary ruleBoundary
Clean restartSame inputs after terminal restartResult and log classification remain deterministicRegression

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.

Trading risk disclosure

Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing one's financial security or lifestyle. Only risk capital should be used for trading, and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical performance disclosure

Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. There are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical results are generally prepared with the benefit of hindsight, do not involve financial risk, and cannot completely account for the impact of financial risk in actual trading. Market conditions, the ability to withstand losses, and adherence to a trading program can all materially affect actual results.

NinjaTrader trademark disclosure

NinjaTrader® is a registered trademark of NinjaTrader Group, LLC. No NinjaTrader company has any affiliation with the owner, developer, or provider of the products or services described herein, or any interest, ownership or otherwise, in any such product or service, or endorses, recommends or approves any such product or service.

Testimonials, when shown, may not represent the experience of other clients and are not a guarantee of future performance or success. Virtual-currency trading carries additional risks. See the CFTC customer advisories. Read the full financial risk disclaimer.