Chapter 27 · In-sample / Out-of-sample
Why is tuning parameters until a backtest looks perfect bad news?
- Skills to practice
- Data validation
- Read first
- Chapter 25 · Backtest
- 3D simulation
- None
Market scene
Lin tests parameters, sees the second half, changes them, and repeats until both halves profit. He still calls the second half out-of-sample. Zhe notes that every change informed by it turns it into research input.
Your decision
How will you separate selection from validation while retaining failed attempts?
Observe the result
The experiment initially shows candidate in-sample scores. OOS appears only after freezing. Changing training length, gap, or candidates hides results; inspecting again increments the page's view count. Refreshing cannot restore independence. The count is only a research-record reminder.
The mechanism
In-sample data proposes and selects parameters; OOS evaluates after freezing. Split time series chronologically: random shuffling may leak adjacent information across sides. A gap reduces some boundary contact, but is not complete purging; inspect label spans and overlapping features individually.
Candidates here rank only by training net profit, preserving candidate order on ties. Tests start with independent initial capital and no position; warm-up may use data already occurring before testing. Each rolling fold reselects from its past training window. Test windows do not overlap, and fold capital is independent, so fold returns cannot be treated as one continuous account.
What it is called
Real markets
Chapter 20 records mechanisms and conditions before outcomes.
Chapter 26 explains how tuning after seeing test results changes their evidential status.
Chapter 23 explains that later data may represent a different environment. Analyze OOS failures rather than deleting them.
Hands-on
- Register training length, gap, candidate range, and selection rule before seeing OOS.
- Freeze and inspect. Record test returns, costs, and drawdown. If tuning again, record the reason and view count.
- Copy/download the report, listing rolling folds as independent experiments and arranging genuinely independent new data.
Observe training scores, freeze candidates and splits, then reveal test results. All data are seed-42 synthetic daily bars. Repeated tuning contaminates the test; this page does not maintain a formal research register.
| Candidates (training only) | Net return | Maximum drawdown at closes |
|---|---|---|
| momentum-3 | -1.04% | 10.40% |
| momentum-5 | 0.19% | 7.29% |
| momentum-10 | 8.01% | 8.32% |
| momentum-20 · Training winner | 19.01% | 5.45% |
| momentum-40 | 6.85% | 9.28% |
Test results for these parameters are not yet revealed. Changing candidates does not erase this page's viewing record.
Edits exist only on this page and clear on refresh. Copy or download promptly.
Course versionV1-docs; sourcep3:report:sample-validation-report.md;Chapter 27 / TRD-BT-003
Records parameters and results at the click only; does not mean the experiment passed.View snapshot to save
Change one variable
Three depths
- FoundationWhy is tuning parameters to a perfect backtest bad news?Chapter 27
- AdvancedHow do Walk-forward and Purged Validation prevent information leakage?Advanced C · Systematic and quantitative trading
- InstitutionalAfter how many parameter attempts does an attractive Sharpe ratio cease to be credible?Institutional
Separate selection rules from testing rules and retain failures.
Use isolation and rolling validation suited to label spans. Record attempt budgets, sample sizes, and uncertainty; see Advanced B.
Continue the project: purge boundary-crossing labels and draw WF boundaries.
Establish research registration and holdout access permissions. Promotion checks the complete attempt history rather than only the prettiest final report.
Continue the project: register multiple attempts and lock the final test.
Questions to take away
Chapter self-test
No. Mark it used for research and arrange new independent validation.
No. Inspect label spans and feature overlaps too.
Not here. Each fold resets capital independently.
Yes, if already available then and future data did not select parameters.
One idea to take away
Finding and validating a pattern on the same data is writing your own exam. Reserve completely unseen data for testing.
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
Why is tuning parameters to a perfect backtest bad news?
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.
In-sample:Not read
Out-of-sample:Not read
Overfitting:Not read
Parameter: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 27 · TRD-BT-003 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.