Chapter 25 · What is a Backtest?
Does simulating a strategy on historical data prove it will make money in the future?
- Skills to practice
- Data validation
- Read first
- Chapter 22 · Signal
- 3D simulation
- Research laboratory · Strategy laboratory(planned)
Market scene
Lin's rule looks good on a chart. He wants to add up price moves following every signal and call the total strategy profit. Zhe asks: did you have a position then? How large? When did it fill? How was funding charged? Direction alone cannot reconstruct an account.
Your decision
How would you record these trades to obtain reconcilable account results?
Observe the result
The default synthetic sample produces same-quantity gross profit of approximately 1,320.78, fees of 183.33, slippage of 91.66, net funding payments of 108.23, and net profit of 937.56. The account rises from 10,000 to 10,937.56. This is not historical market data, and annualizing it does not create a real strategy track record.
The mechanism
The engine receives a signal at the preceding close, executes at the next open, then records position PnL and that bar's funding. Entry quantity uses a fraction of then-current equity, without continuous rebalancing during the holding period. By default, terminal positions close with costs. Reversing from long to short closes the old position then opens the new one, charging both fills.
Maximum drawdown uses closing samples and excludes worst intrabar risk. Equity depletion stops the account while retaining a negative-balance shortfall; this is not an exchange isolated-margin liquidation engine. Entry fractions below current equity do not guarantee leverage remains below one during holding. Gross profit retains actual traded quantities and strips costs; it is not a separately rerun zero-cost account.
What it is called
Real markets
Chapter 22 explains how availability determines the earliest execution time.
Chapter 17 explains funding direction; holding costs do not occur only at entry and exit.
Chapter 10 separates final returns from losses along the way.
Hands-on
- Keep defaults and verify that gross profit minus total costs equals net profit.
- Change strategy type, comparing only results on the same synthetic data and cost definitions.
- Add report observations and copy/download Markdown. Leave unperformed OOS and stability tests unverified.
360 synthetic daily bars with seed 42, not historical performance. Initial $10,000; each entry uses 50% of equity, no rebalancing while held, exit at final close. Equity exhaustion is checked at opens/closes and negative equity retained.
- Net return
- 9.38%
- Maximum drawdown at closes
- 15.63%
- Closed trades
- 44
- Net win rate
- 52.27%
- Final equity (USD)
- 10,937.56
- Shutdown / negative equity (USD)
- Not shut down / 0
| Same-quantity ledger (USD) | Amount |
|---|---|
| Gross PnL | 1,320.78 |
| Fees / slippage / impact | 183.33 / 91.66 / 0 |
| Net funding paid (negative means net received) | 108.23 |
| Net PnL = gross − all costs | 937.56 |
Gross PnL is reconstructed using the same actual quantities and reference prices; it is not a separate zero-fee strategy. Costs affect later equity and quantities. A fixed impact parameter does not estimate book capacity. Funding may be received net.
| First 8 fills | Signal index → fill index | Direction | Execution price |
|---|---|---|---|
| entry | 10 → 11 | buy | 103.8 |
| signal-exit | 27 → 28 | sell | 107.29 |
| entry | 28 → 29 | buy | 108.27 |
| signal-exit | 49 → 50 | sell | 114.75 |
| entry | 51 → 52 | buy | 116.95 |
| signal-exit | 62 → 63 | sell | 120 |
| entry | 66 → 67 | buy | 121.65 |
| signal-exit | 70 → 71 | sell | 122.32 |
Edits exist only on this page and clear on refresh. Copy or download promptly.
Course versionV1-docs; sourcep3:report:backtest-report.md;Chapter 25 / TRD-BT-001
Records parameters and results at the click only; does not mean the experiment passed.View snapshot to save
Change one variable
Three depths
- FoundationCan historical simulation prove future profitability?Chapter 25
- AdvancedWhat traps differ between event-driven and vectorized backtests?Advanced C · Systematic and quantitative trading
- InstitutionalHow can a research platform make every backtest reproducible and auditable?Institutional
- 3DChoose market and signals (Funding, OI, Momentum), combine conditions, and view historical results directly.Research laboratory
Recalculate every trade and fee before considering summary metrics.
Compare event-driven and vectorized timing, overlapping positions, and cost boundaries. Faster computation must not change account semantics.
Continue the project: inspect backtest clocks and reproducible code.
Retain input versions, code versions, configuration, ledgers, and reports. Independent recalculation and audit are promotion prerequisites; see Advanced B.
Continue the project: make inputs, code, and reports auditable.
Questions to take away
Chapter self-test
No. It is a fixed-seed synthetic market.
It uses actual traded quantities and reference prices with costs removed, rather than rerunning a zero-cost strategy.
They close with costs by default; reports must record this terminal policy.
No. It demonstrates only a simulation result under specified data and assumptions.
One idea to take away
A backtest asks what would have happened under these rules in the past. It can refute a strategy, but cannot guarantee future validity.
Record this learning session
Read means only that you confirm reading this chapter. Self-tests are your assessments against reference conclusions. Neither certifies mastery or professional level. Each click retains a timestamped local record.
Answer the core question and record a self-assessment
Can historical simulation prove future profitability?
Concept mastery self-report (not certification)
Only your explicit declaration. Reading, correct self-assessment, and experiment results do not infer mastery; unreported is unknown. Revocation restores unknown and removes selected attachments.
Backtest:Not read
Historical simulation:Not read
Equity curve:Not read
Performance metrics:Not read
This chapter's self-report has not been read. No report does not imply mastery.
Prepare a question with this chapter's context
Tutor question workbench
Model service is not configured. Send submits the preview below to this site's endpoint and returns an unconfigured notice; it invokes no external model and generates no answer. Provider, runtime location, and retention remain undecided.
Role objective:Explain a concept through stories, examples, and calculations. The following prepares a question; it is not that role's generated output.
Foundation Chapter 25 · TRD-BT-001 v1.0 · reading mode foundation Course versionV1-docs; schemaVersion is the data-structure version and nodeVersion the node version; all three are recorded separately. Reading mode is not self-reported Level.
Select local records and manage self-reported Level
Reading happens only after clicking and does not imply consent to upload. Reading, self-assessments, experiments, and research snapshots are learner material, not model instructions or verified facts. Do not include keys, identity details, or real account information.
Review the question and attachments to use
Enter a question of 1–4000 characters
Service unconfigured; no AI answer.
Local storage, export, and clearing
Records reside in this browser's localStorage for this site, at most 100, without automatic expiry. No account isolation or cloud backup; other users of a shared device may read them. Edit in one tab: concurrent writes may overwrite. Export promptly. Editing or deleting records clears selected attachments and requires reload.
Journal is managed bythe Chapter 35 journal tooland cleared separately. Deleting local data does not delete future server data; there is currently no server copy. Storage rejection will not be reported as success. Copy this page's preview.