Trader OS
Phase 5 · Backtesting foundations

Chapter 25 · What is a Backtest?

Does simulating a strategy on historical data prove it will make money in the future?

Reading mode
Skills to practice
Data validation
3D simulation
Research laboratory · Strategy laboratory(planned)

Market scene

Your current reading mode collapses this section.

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

Your current reading mode collapses this section.

How would you record these trades to obtain reconcilable account results?

Observe the result

Your current reading mode collapses this section.

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

BacktestBacktest
Replay past data under explicit decision and execution rules to produce simulated account records.
Historical simulationHistorical Simulation
Test rules on data that actually occurred. This page is a reproducible synthetic demonstration, not historical performance.
Equity curveEquity Curve
Account capital plus unrealized position PnL over time.
Performance metricPerformance Metric
A summary of returns, risk, and trading behavior; retain definitions and the complete ledger alongside it.

Real markets

Signals and fills are separateResearch engines

Chapter 22 explains how availability determines the earliest execution time.

Holding incurs funding cash flowsDerivatives

Chapter 17 explains funding direction; holding costs do not occur only at entry and exit.

Inspect drawdowns as well as returnsAccount risk

Chapter 10 separates final returns from losses along the way.

Hands-on

LabRecalculate an account report25 minutesPage experiment and local text
  1. Keep defaults and verify that gross profit minus total costs equals net profit.
  2. Change strategy type, comparing only results on the same synthetic data and cost definitions.
  3. 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 PnL1,320.78
Fees / slippage / impact183.33 / 91.66 / 0
Net funding paid (negative means net received)108.23
Net PnL = gross − all costs937.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 fillsSignal index → fill indexDirectionExecution price
entry10 → 11buy103.8
signal-exit27 → 28sell107.29
entry28 → 29buy108.27
signal-exit49 → 50sell114.75
entry51 → 52buy116.95
signal-exit62 → 63sell120
entry66 → 67buy121.65
signal-exit70 → 71sell122.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

IfRaise execution costs only
Net profit and later available capital change, so simply extrapolating original traded quantities may be wrong.
IfChange the lookback only
Signals, trade counts, and paths all change; do not compare endpoints alone.
IfInspect only the final balance
You miss position valuation, interim drawdowns, and negative-equity shortfalls.

Three depths

One knowledge nodeTRD-BT-001: one question at each of three depths
  1. FoundationCan historical simulation prove future profitability?Chapter 25
  2. AdvancedWhat traps differ between event-driven and vectorized backtests?Advanced C · Systematic and quantitative trading
  3. InstitutionalHow can a research platform make every backtest reproducible and auditable?Institutional
  4. 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.

Questions to take away

4
What are the probability and payoff odds? Is expectancy positive?
Did data enter decisions only when truly available?
6
How large should the position be?
How do costs and funding constraints enter the account?
7
Is there enough liquidity, and what will execution cost?
Did results ignore intrabar losses or execution failures?

Chapter self-test

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.

Select attachments individually (at most 10; none selected by default)

No loaded records. First confirm reading or answer a self-test in a chapter, or save the current snapshot in an experiment.

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.

Manage local records and Tutor questions

On this page