ChartnautDocs

In sample and out of sample

Every number on a Forward Insight was measured on a stretch of past market data. That stretch decides which setups can test the number and which can't. This page explains the difference, why it matters more than the percentage, and why Chartnaut hides an insight in a replay until you pass the date its data ends. You don't need any statistics to follow it.

Where an insight's number comes from

Say you think BTC tends to reach the prior day's high after it breaks its opening range from above the upper VWAP band. Chartnaut answers that in three steps:

  1. A definition marks every time that break happened.

  2. You run it over history, January 2024 to December 2025, and it finds 61 breaks.

  3. A study checks what happened after each one. Price reached the prior day's high 51 times.

Put that study on the chart and you have a Forward Insight that reads 51 in 61, or 84%. Those 61 breaks are all the number knows about.

In sample and out of sample

The 61 breaks are the sample: the setups the number was measured on.

  • A setup in sample is one of those 61. Its result is already counted in the 51 in 61.

  • A setup out of sample is one the number has never seen. Its result played no part in the 84%.

On a timeline it looks like this:

  before the run             the measured dates            after the data ends
 ----------------|==========================================|---------------------->
  out of sample                   in sample                       out of sample

The setups after the data ends matter most, because every setup you will ever trade live is one of them.

Think of a maths exam. Your teacher gives you a past paper with the answers, you learn it, and then the exam is that same paper. You score 100%, and the score says nothing about whether you can do maths. Sit a paper you have never seen and the score means something. An in-sample setup is the past paper. An out-of-sample setup is the new one.

Why an in-sample number flatters you

An in-sample number tends to look better than the idea really is, even when you are being honest. There are two reasons.

You kept it because it looked good. Research is trying things. You test the break on its own, then above VWAP, then only in London, then only on Tuesdays, and you keep the version with the best number. Each change makes the number fit those particular 61 setups a little more closely, and tells you a little less about the next one. This is called overfitting, and it is the most common way a strategy looks great on paper and loses money.

Some of it is luck. Have 20 people each flip a coin ten times, and on average one of them gets 8 or more heads. That person has no gift for coins. Their next ten flips will land around 5 heads like everyone else's. Test 20 filters on the same data and one of them will look brilliant in exactly the same way. In sample, the lucky filter and the good filter look identical.

A small sample makes both worse, which is why you read the sample before the percentage.

Why out of sample is so useful

Nothing about the number could have been tuned to a setup it never saw, so out-of-sample setups are the only fair test of the idea. A real edge keeps showing up on them. A lucky one falls apart.

Say the insight reads 84%, and these are two ways the next 24 breaks could go:

The next 24 breaks

Rate

What it tells you

19 reached the high

79%

Lower than 84%, which is normal. The idea held up on setups it had never seen

12 reached the high

50%

Most of the 84% came from the sample. Don't trade on that number

Expect the out-of-sample rate to come in below the in-sample one. The question is whether enough of it survives to be worth trading. 24 setups is still a small count, so keep adding to it.

Where Chartnaut shows it

Where

What you see

An insight's row in the picker and in your library

Measured Jan 2024 – Dec 2025, the dates of its sample

The label on the chart

An amber In sample badge next to Insight, when the latest setup is one it measured

The card when you click a mark

An amber note: This setup is one of the 61 measured. The numbers include it, so it can't test them. Setups after 31 Dec 2025 can.

A kept outlook

An In sample tag on its frame, and on its row in the card

Screenshot to capture · 4:3 · in-sample-card-note
An insight card on a setup the insight measured, with the amber in-sample note
Route/charts
FocusThe insight card: header, the amber note under the figure, and the chart label with its amber In sample badge if it fits in the crop
StateReal-time Charts on the insight's market and timeframe, with its definition added and the insight active.
Sourceclient/src/components/terminal-studies/InSampleNotice.tsx:12 InSampleNotice
The amber note on a setup the insight measured.

Live, Chartnaut hides nothing. You see every number, and the amber marks tell you which setups can't test it. Forward Insights on the chart covers the rest of the card.

Why a replay hides the numbers

A replay only teaches you something if you don't know what comes next. You see the market as it was on a past day and make the call yourself.

An insight measured over that same day breaks this. Replay a break from March 2025 with the insight showing, and you see 84% and an outlook drawn ahead of the bar. You take the trade and it reaches the high. Of course it does: that win is one of the 51 the number already counted, and the number was worked out from the bars you haven't been shown yet.

Do that for a whole session and you finish with a great equity curve and a strategy that feels proven. All you have done is read the answers back to yourself, and the first real test comes with real money.

So Chartnaut hides an insight in a replay until the replay passes the date its measurement ends. There is no setting to turn this off.

That date falls a little after the end of the study's data, because the last setups in the study read the bars that came after them. It is the end of the data plus the furthest any event read ahead, rounded up to the next bar.

Where the replay is

What you see

Before the date

The definition keeps marking setups. The active insight is paused and reads Starts 1 Jan 2026 in this replay. A click on a mark shows no numbers and no outlook, and the card says why. The picker reads Usable in this replay from 1 Jan 2026

Past the date, on a new setup

The numbers and the outlook show in full. This is a true out-of-sample test

Past the date, on an older setup you click

The numbers show with the amber note. The replay is already past the end of the data, so they give nothing away

Screenshot to capture · 4:3 · in-sample-replay-hidden
An insight card in a replay before the date its data ends, with no numbers and the Read more link
Route/charts
FocusThe insight card: header, insight name, the message saying why the numbers are hidden, and Read more
StateA replay session on the insight's market, on a date inside the insight's Measured range, with its definition added and the insight active.
Sourceclient/src/components/terminal-studies/EventInsightPopover.tsx:1360 hidden_lookahead
An insight card in a replay before the date its data ends.

Leave some data to test on

An insight measured right up to today has no history left to test on. You can only wait for new setups live. To keep a test set, stop the sample early:

  1. When you run the definition over history, set To several months before today. A two-year run ending six months ago leaves six months the insight has never seen.

  2. Build your study on that run and put it on the chart.

  3. Start a session with a Fixed date after the insight's Measured range ends, and open it in Replay.

  4. Trade or tally each new setup, and compare your count with the insight's number.

Two habits keep the test honest:

  • Test once. If the out-of-sample setups disappoint you and you go back to adjust the definition, they stop being out of sample. You made the change knowing how they turned out. Fresh setups are the only test left.

  • Watch the date when you run it again. A new run over newer data moves the sample forward, so setups that were a fair test become part of the measurement. Check the Measured range on the new insight.