How to build a trading system: an executable specification
Translate a hypothesis into timed observations, orders, accounting and rejection rules before running a strategy search.
Write the hypothesis and its alternative
Start with an observable proposition, not a collection of indicators. State what behaviour the proposed entry detects, why it might matter and which alternative explanation a baseline should distinguish. A pattern that merely tracks broad market exposure needs a different comparison from a rule intended to improve execution timing.
Choose a narrow instrument and observation route for the first experiment. Describe the required historical inputs and reject cases where they cannot be established. A missing data integration is an unfinished experiment, not evidence that a market has failed a full research method.
Give every input an availability clock
For each field, store when the underlying event occurred and when the system could first know it. A completed daily value cannot inform an order sent earlier that same session. Revised economic or constituent data require a historical availability record; a current database snapshot cannot automatically supply one.
The scikit-learn cross-validation guidance separates fitting from evaluation, while TimeSeriesSplit provides ordered splits for time-dependent samples. These tools help implement part of a design. They do not decide your feature timestamps, overlapping-label treatment or whether an execution assumption is realistic.
A fictional bar-close specification
Suppose an invented rule evaluates a completed five-minute bar ending at 10:05 and can first submit an order after receiving that completion. An assumed fill at 10:04 is invalid under this specification, even if the bar's final value would later justify entry. Preserve both the event time and receipt time.
Write the order type, expiry, first permissible submission time and fill policy before inspecting outcomes. If only bar extremes are available, do not pretend they identify the exact sequence of touches. An explicit ambiguity rule is preferable to selecting the profitable path separately for each historical trade.
Separate entry, exit and allocation identities
An entry condition chooses eligible opportunities. The exit policy determines when an accepted position closes, and allocation determines exposure. Version those decisions separately so a changed exit cannot silently rewrite the original entry experiment. Use one predeclared exit in a particular experiment rather than repeatedly selecting the one that makes each sample look best.
Define the maximum hold, stop handling, competing-event priority and administrative exceptions. A risk scenario in a specification is not a guaranteed loss ceiling. If human judgement remains, record the decision boundary and observations instead of describing the entire process as deterministic.
Build state and accounting before optimisation
Specify accepted, pending, partially filled, cancelled and closed states with stable event identifiers. Decide how duplicates, late events and missing acknowledgements are handled. Reconcile cash, quantity, fees and open exposure after each transition. A displayed equity curve should be traceable to those records.
Keep costs and currency conversion explicit. Avoid silently using a future quote for a missing observation. Save untradeable candidates and rejected instructions, not only successful entries. The smallest honest implementation can be less impressive visually while making a later independent review much easier to reproduce.
Define a completion package
A useful first release is a frozen rule sheet, input manifest, executable fixtures, candidate log and declared evaluation plan. Record what would reject the hypothesis and which data must remain reserved. Software correctness and economic validation have different evidence requirements, so passing one is not completion of the other.
This guide does not prescribe a profitable strategy or run a backtest. Its output is a testable contract that can survive another reviewer implementing it. If a required input, execution model or validation stage remains missing, report that exact unfinished stage instead of advertising a production-ready system.

Evidence handoff
| Check | Record | Boundary |
|---|---|---|
| Observation | Event and earliest availability | No future completed value |
| Decision | Frozen entry, exit and allocation | No retrospective policy rewrite |
| Execution | Order state and accounting | An instruction is not a fill |
Column definitions: hypothesis_id, instrument, input_field, event_time, available_time, entry_version, exit_version, allocation_version, order_type, submission_time, expiry_rule, fill_policy, cost_policy, baseline, rejection_rule, reserved_period.
No example trade or user record is stored in the download. Keep credentials and personal account identifiers out of shared copies.
A filled specification beside the original method
The new source packet makes a small mechanics contract executable: 64 invented bars, one fixed 3/5 crossover, one-unit entries, one time exit and 0.10 fixed fee per side. The standard library handles fills, while the public transactions and independent checks show the resulting chronology and cash. Six simulated positions net negative 1.20. No economic market hypothesis, optimiser, licensed history, untouched financial holdout or model promotion is claimed. The filled rule sheet is a draft example, not canonical proprietary research. Retain the original build-method questions when moving to actual source data.