Python strategies on MT5: a deployment contract you can verify

A notebook result and a broker position are different artifacts. Define and test the contract between them.

Research cutoff: 22 October 2026. Evidence synthesis and original analytical frameworks; no platform performance experiment.

A copper-lined plug held above a silver and clear-glass docking bridge, illustrating an explicit research-to-execution handoff.

The key distinction

A Python-to-MT5 workflow needs an explicit contract for data, units, execution authority and recovery. A successful backtest or preliminary order check cannot establish that the live account will behave as intended.

First identify where Python actually runs

The reader question is straightforward: what must be true before a researched Python strategy can operate an MT5 account? Start by drawing the deployment boundary. MetaQuotes' official Python package communicates with a MetaTrader 5 terminal; its functions expose account, market and trading operations. That is a specific architecture, rather than a generic promise that Python runs inside every hosted MT5 service. [1]

A platform may instead host the strategy separately and route authorised instructions through its own connectivity layer. Ask which process owns the decision, which component holds credentials, which component submits requests and which record is authoritative after a disconnect. A notebook, a strategy worker and an MT5 terminal can fail independently. Treating them as one object hides the recovery problem.

This article proposes a deployment contract, not a tested broker integration or instructions to place a live order. Its original contribution is a small set of artifacts that lets an operator inspect the transition from research to execution.

Write a decision contract before generating code

Describe the rule in terms another person could reproduce: instrument, session, observation time, entry condition, invalidation, size and exceptional conditions. Specify whether decisions use completed bars or a forming bar, how daylight-saving changes affect sessions, and whether an existing position blocks another entry.

Consider an illustrative session breakout. “Buy above the morning high” leaves open when the morning ends, whether a price touching the boundary qualifies, which side of the quote triggers entry, and whether the system may re-enter after a stop. Record a few expected trades and non-trades before inspecting aggregate performance. These examples are specification checks, not evidence of alpha.

The contract should say what happens when necessary information is missing. “No valid observation” must be distinguishable from “the entry rule evaluated false.” Otherwise a broken feed can masquerade as a quiet strategy.

Bind data to the clock the rule expects

The native bar API documents UTC timestamps and limits the history returned to data available through the terminal's chart history. A successful call therefore does not establish that a requested historical period is complete. [5]

Create a data manifest with symbol mapping, source, extraction time, requested and received range, missing periods, timezone, bar convention and file checksum. Retain permission and licensing information separately from the strategy. Do not assume access permits redistribution.

For the breakout example, inspect the exact observations used to form the session high and the first observation allowed to trigger entry. A timezone error can move both while leaving a plausible-looking chart. Compare these hand checks with the research engine and the live adapter before comparing profit metrics.

Convert units at one explicit boundary

In MetaQuotes' request structure, volume is expressed in lots, stop-loss and take-profit fields are price levels, and deviation is expressed in points. Those units belong to that interface. A backtest engine may instead require a stop distance as a fraction, a number of ticks or a cash amount. [3]

Suppose an illustrative long entry is 100 and its intended stop is 98. The price is 98; the absolute distance is 2; the entry-relative fraction is abs(entry − stop) / entry = 0.02. These representations express the same intended level only when translated correctly. Passing 98 into a fraction-based sizing function is a different instruction.

With equity of 10,000 account-currency units and a risk fraction of 0.005, the loss budget is 50. Dividing 50 by the stop fraction 0.02 gives notional exposure of 2,500, not 2,500 instrument units or broker lots. At entry price 100, that is 25 units only under an instrument multiplier of one and matching quote/account currency. This scenario excludes fees, gaps and slippage. Broker lots require tick-value/tick-size or contract conversion, currency conversion when relevant and an explicit allowance for costs and execution uncertainty. It is dimensional arithmetic, not a claim about VC Trader AI's sizing implementation or a risk recommendation.

Keep conversion in a named adapter with explicit input and output units. For actual lots, also account for contract specifications, account currency, volume increments and relevant conversion rates. Query the account's symbol metadata instead of copying example settings: the documented symbol interface exposes minimum/maximum volume, volume step and stop constraints. [6]

At a 2% stop distance, 50 currency units of planned loss imply 2,500 notional or 25 units at price 100. These are not broker lots.
Original sizing scenario. Equity 10,000; risk fraction 0.005; entry 100; multiplier one; common account and quote currency. Costs, gaps and broker constraints excluded. Download scenario CSV. Code and assumptions are retained with the research package.

Separate checking, submission and reconciliation

order_check returns a preliminary request-check result; its documentation explicitly warns that successfully sending a request does not entail successful execution. order_send returns a trading result structure. Neither should be reduced to an unexamined “success” badge. [2] [3]

Separate checking, submission and reconciliation
Stage Artifact to retain Question it answers
Intention Strategy version and decision ID What action was intended?
Validation Account snapshot and check response What was checked, using which state?
Submission Exact request and broker response What was actually sent and returned?
Reconciliation Orders, deals and positions observed afterwards What exposure now exists?

The last row matters after an uncertain network outcome. A blind retry can conflict with an action already processed. Use persistent intent identifiers in your own system, query the broker's observed state and resolve ambiguity before creating a fresh economic action. A comment or strategy identifier alone should not be assumed to provide server-enforced idempotency.

Design recovery around meaningful outcomes

The official return-code table distinguishes a placed order, completed request, partial completion, timeout, invalid volume, invalid stops, changed prices and excessive request frequency. Their meanings differ; a single retry policy is inadequate. [4]

Define recovery classes rather than teaching a model to improvise them. Invalid units require correction. Changed prices require the original decision to remain valid within its limits. A partial completion requires exposure-aware handling. An uncertain transport result requires reconciliation. A rate problem requires a bounded scheduling policy, not an unbounded loop.

Validate recovery on a demo environment, including process restart, stale observation, rejected request and lost response. Record the expected state and observed state for each test. Demo evidence can verify parts of the software path; it cannot reproduce all live liquidity, slippage or broker conditions.

Give deployment an inspectable handoff

Before enabling automation, collect the strategy specification, versioned code, data manifest, chronological evaluation, cost assumptions, unit conversion checks, account permissions, recovery tests, monitoring destination and stop procedure. Assign an owner to the reconciliation process and an owner to intervention. If nobody owns an ambiguous state, the contract is unfinished.

In VC Trader AI's current public scope, Python research and cloud testing connect to managed strategy hosting and MT5 operations. Customer-approved deployed strategies may execute automatically; an agent-proposed order requires individual confirmation. This describes the declared product scope, not an independent audit of every recovery condition. [7]

The practical acceptance criterion is observable behaviour: a reviewer can reconstruct why an action was proposed, verify its units, identify the resulting account state and stop further actions. Historical returns answer a different question. Use the walk-forward evaluation guide for research validity and the risk-control framework for authority and failure testing.

Sources and scope

Sources checked on 22 October 2026. Organisational authorship: Vanquish Capital Technologies, with AI assistance. External findings, proposed engineering criteria and mathematical scenarios are distinguished in the text. Product statements describe the current first-party early-access scope, not independent verification of every control. No customer outcome, original trading experiment or investment recommendation is claimed.