Skip to content
← Learning hub
Engineering / Tutorial

From an .mq5 file to a testable EA

A practical review sequence, illustrated by specific issues in the 15-file source collection.

Edge Quant editorial · 28 October 2026 · About 7 minutes

A source file is the beginning of a review. Before interpreting a backtest, establish what the program actually does.

Start with an inventory

Preserve the original and work on a separate version. List includes, custom indicators, symbol assumptions, inputs and author notices. The time-range breakout upload references an absent .mqh file. The second volatility-breakout variant depends on Synthetic_VIX when its default filter is enabled. Neither dependency is replaced by an attractive strategy description.

Trace one entry and one exit

Choose a small, concrete price example. Calculate the entry trigger, stop and target by hand, then compare them with the expressions in the code. In the supplied HMA example, the buy target is placed below the ask. Its two indicator handles also receive the same fast-period settings. These are observations from the supplied version, not compiler or backtest results.

Ask which positions the EA owns

A close routine can be syntactically valid and still act on the wrong trades. The supplied Go Long example iterates through every position and pending order without filtering by symbol or magic number. Write the intended ownership rule and test it with unrelated positions present in a controlled test environment.

Distinguish a request from an outcome

MQL5 documents that OrderSend() returning true does not establish that a trade was executed. Inspect the result and subsequent state before consuming a signal or marking a position as open. Likewise, verify that CopyBuffer() returned the required number of values before using an array. Official API references ↓

Test what happens after a restart

Memory-only daily counters and ticket variables disappear with the program's state. Define whether the EA should reconstruct positions and today's activity, remain inactive, or require an operator decision. Then test that behavior explicitly. Restart recovery should not be an accidental consequence of initialization.

Separate four milestones

  1. Source review: understand the code, dependencies and obvious inconsistencies.
  2. Compilation: obtain the actual MetaEditor result for the exact version.
  3. Behavior tests: check representative entries, exits, rejection paths and restart cases.
  4. Research: evaluate the strategy with documented data, costs and selection history.

Passing one milestone does not prove the next. The free source collection currently reports a limited static reading; it does not claim successful compilation or historical performance.

Primary references

References reviewed 28 October 2026. Original exercises and project-specific observations are identified separately.

Keep exploring

Browse the MQL5 source collection ↗

Educational engineering and research guidance. Examples do not establish a profitable or live-ready trading strategy.