AllMarkets Trading

Automated Trading Strategies: Rules, Costs and a Testing Plan

An automated strategy needs more than an indicator and a favorable chart. It needs a precise decision rule, a position-sizing rule and defined behavior when data or execution fail. This guide is a test-design framework; it does not present a tested strategy or a forecast return.

Distinguish strategy families by their hypothesis

FamilyHypothesis to testFailure case to include
Trend followingDirectional continuation persists long enough to exceed costsRepeated reversals and whipsaw
Mean reversionA defined deviation tends to narrow within a bounded holding periodA persistent move rather than a temporary deviation
BreakoutMovement beyond a predeclared range continues after entryFalse breaks, gaps and worse fills
Allocation rebalancingRules maintain a target exposure or risk allocationTurnover, taxable realizations and prolonged trends

These are hypotheses and operational categories, not a ranking of profitable approaches. A rule that maintains an allocation is not automatically a rule that maximizes returns.

Write a strategy specification before optimization

A testable specification identifies the tradable instrument, data timestamp, signal time, entry order, exit order, exposure limit and exceptional states. For example, “evaluate a completed bar, place an order only after that bar closes, stop entering after the daily exposure cap” is more precise than “buy when momentum is strong.” The values and the profitability of such a rule still have to be tested.

Decide how to treat missing data, duplicate messages, rejected orders, partial fills, stale quotes and restarts. If the implementation silently retries an already accepted instruction, the strategy being executed can differ from the one described in the research notebook.

Keep research, selection and evaluation separate

  1. State the economic hypothesis and the conditions that would contradict it.
  2. Choose development data and record the data source and adjustment rules.
  3. Define a bounded parameter search and keep a record of how many alternatives were tried.
  4. Freeze the chosen rules before evaluating a separate forward period.
  5. Test cost and delay assumptions across conditions that matter to the order type.
  6. Run an operational rehearsal with test accounts and reconcile every instruction against its outcome.

MetaTrader’s official documentation distinguishes a single historical test from repeated parameter optimization and describes forward-testing options. The existence of those features does not validate a strategy. Repeatedly inspecting and tuning against a held-out period defeats its purpose as an untouched check.

Measure sensitivity, not only the best row

Imagine two hypothetical settings with the same net result. One remains similar under a small change in spread or lookback; the other becomes negative after one tick of extra cost. That comparison is a sensitivity exercise, not evidence that the first setting will earn money. Record the assumptions that produced the difference and decide whether the sample supports a stable explanation.

Use a trade-level cost ledger when possible. Commission, spread, slippage, financing and fixed software costs may enter the result at different stages. Avoid subtracting a charge twice when it is already incorporated in execution prices.

Record the decision and a shutdown procedure

A useful test report contains a versioned ruleset, data interval, execution model, trade count, capital and leverage assumptions, balance/equity path, cost treatment and unresolved failures. Include why the candidate was retained or rejected. Keep an operational stop separate from an analytical stop: disabling software must have a defined treatment for existing orders and positions.

No original backtest is claimed here. A real comparison requires the underlying data, code, configurations and results. Documentation and arithmetic tools help structure that work; they cannot substitute for it.

Related tools and guides

Sources and scope

Primary documentation checked 2026-10-16. Provider documentation describes its own features; it is not independent performance evidence or an AllMarkets endorsement.