A crossover family under research discipline
The final strategy chapter asks whether the original result survives nearby parameters, different periods and more realistic assumptions. This is a study of one family, not a search for the best-looking cell.
Copy the portfolio config to examples/learning/sweep.json, retain its global money and data settings, and replace runs with this complete entry:
"runs": [{
"symbol": "fut:XCME:ES",
"inputs": {"Fast": [10, 20, 40], "Slow": [100, 200, 300]}
}]Arrays create a Cartesian sweep: nine runs. Remove a fixed id, because one stable ID cannot identify all nine expansions. Capital allocated to this configured run is subdivided equally across those nine runs. If comparing account-return percentages with a standalone run, keep each run’s capital comparable or explicitly normalize risk; a smaller denominator alone can make a parameter sweep look more impressive.
Separate development from evaluation
Choose the split before studying the outcomes. For example:
bin/algo run --config examples/learning/sweep.json --verify \
--date-from 2015-01-01 --date-to 2019-12-31
bin/algo run --config examples/learning/sweep.json \
--date-from 2015-01-01 --date-to 2019-12-31 \
--results-dir results/learning/developmentSelect a rule using only that development period. Freeze its code, inputs, costs, sizing, data definition and selection rule in a single-run config. Then run it on the untouched 2020-2024 interval with a fresh results directory. Pre-evaluation bars can warm its indicators; they must not become evaluation trades. Reopening the holdout repeatedly to adjust the strategy turns it into another development sample.
A run matrix is not a walk-forward scheduler. For rolling folds, explicitly record each training window, selection, following test window and capital convention. Stitch only out-of-sample segments with a defined policy for positions at boundaries. Never present all nine mutually exclusive parameter variants as a real nine-member allocation unless that was the intended strategy.
Read more than net profit
Use marked equity as well as closed-trade equity: open losses can be hidden by looking only at completed trades. Compare drawdown depth and duration, trade count, average trade versus costs, long/short results, exposure and dependence on a few exceptional trades. Sharpe, CAGR and profit factor can be unavailable or unstable on short samples. Zero-cost and higher-cost runs should be separate saved experiments, with assumptions visible.
For a benchmark, rerun a comparable equity study with --benchmark eq:ARCX:SPY:adj=split, or supply the appropriate supported benchmark definition for the market. Check the capital, exposure and dividend conventions before interpreting relative performance. A one-share strategy against a fully invested benchmark mostly measures unused cash.
Preserve the commit/build ID, dependency pins, config, archive/roll/calendar provenance, results and logs. The series cache is an optimization, not proof that the archive is unchanged; after source corrections use --cache refresh or an isolated cache. A supplied .algorun file helps another reader inspect the actual observations behind the result.
Extend the model only when the question requires it
The repository’s more elaborate strategies offer reusable design choices: volatility-normalized levels, equity-aware sizing, pending entries, one-trade per-session rules, cooldowns, re-entry campaigns and separate per-signal lots. Add these one at a time and compare the causal change in orders.
A sizing recipe is to divide a chosen monetary risk budget by stop distance * point value, round down to whole units, then apply quantity, liquidity and margin limits. Validate a positive finite distance and valid metadata, and never force a one-contract minimum when the risk budget cannot afford it. Gaps and slippage can exceed the nominal stop risk. A percentage risk input is meaningless until its equity source, currency and timing are defined.
Keep signal calculations separate from order reconciliation. Small pure functions for a range, cross or target exposure are easy to exercise on hand-built bars; integration tests should check fills, cancellations and account effects. Add fixtures for missing references, equal timestamps, early closes, roll cuts, denied entries and still-working exits. A strategy selftest alone does not cover these behaviors.
Source to study: strategies/kit/, the strategy tests beside each demo, and scripts/strategy-guide/smoke.py for this book’s executable checks.
Previous: A portfolio of crossover strategies · Next: Critical limits and desirable next steps