# Building & Backtesting a Model

> Turning concepts into a testable system.

Module: ICT / Smart Money Concepts — Finotaur Academy (free lesson)
Source: https://www.finotaur.com/academy/ict-smart-money/building-and-backtesting-ict-model

## You'll be able to

Turn ICT concepts into a written rule set, backtest it bar by bar without hindsight, and judge the result with expectancy, a confidence interval and a realistic losing-streak estimate rather than a feeling.

## In plain words

Building and backtesting an ICT model means writing every condition (bias, liquidity, shift, entry, stop, target, time window) precisely enough that anyone would mark the same trades, then replaying historical charts one bar at a time, logging every qualifying setup and measuring the results. The key output is expectancy: the average result per trade in R, the multiple of what you risk. Because ICT concepts have no published statistical proof, this process is how a trader finds out whether their version of the framework has an edge, how large it is, and how uncertain that estimate still is.

```takeaways
- **Expectancy (R) = win rate × average win − loss rate × average loss.** Positive is necessary, not sufficient.
- A **written rule set** and **bar-by-bar replay** are what separate a backtest from a highlight reel.
- Small samples are noisy: 60 trades can leave you unable to say whether the edge is **above zero**.
- Split data into **in-sample** (design) and **out-of-sample** (verification), then **forward-test** at small size.
```

## Quick demo

**Results of a hypothetical sweep-and-shift model over 60 backtested trades:** 24 winners averaging **+2.4R**, 36 losers at **−1R** each.

- Win rate = 24 ÷ 60 = **40%**.
- Expectancy = 0.40 × 2.4 − 0.60 × 1 = 0.96 − 0.60 = **+0.36R per trade**.
- Profit factor = gross wins ÷ gross losses = (24 × 2.4) ÷ (36 × 1) = 57.6 ÷ 36 = **1.6**.
- Breakeven win rate at 2.4R = 1 ÷ (1 + 2.4) ≈ **29.4%**.

Looks good. Now the honest part:

- **Uncertainty in the win rate.** The standard error is √(0.4 × 0.6 ÷ 60) ≈ 0.063, so a rough 95% range is **27.6% to 52.4%**. The low end is below the 29.4% breakeven.
- **Uncertainty in expectancy.** The standard deviation of these R outcomes is about 1.68, so the standard error of the mean is 1.68 ÷ √60 ≈ 0.217R. A rough 95% range is **−0.07R to +0.79R**. Zero is inside it.
- **How many trades to exclude zero?** If the mean and spread stayed the same, you would need about (1.96 × 1.68 ÷ 0.36)² ≈ **84 trades**.

```chart
{
  "type": "bar",
  "title": "Lower bound of the 95% range for expectancy by sample size (exact arithmetic, hypothetical model)",
  "data": [["30 trades", -0.24], ["60 trades", -0.07], ["120 trades", 0.06], ["240 trades", 0.15]],
  "unit": "R",
  "unitPosition": "suffix",
  "highlight": ["120 trades"],
  "notes": { "120 trades": "First sample size here where the lower bound is above zero." },
  "caption": "Assumes the same mean (+0.36R) and standard deviation (1.68R) at every sample size, using mean − 1.96 × SD ÷ √n. Hypothetical model, not real results."
}
```

## Full explanation

### Step 1: write the hypothesis

Start with one sentence: "In ES, between 9:30 and 11:00 a.m. New York, a sweep of the prior day's or overnight low followed by a 5-minute structure shift, entered at the FVG midpoint, reaches the overnight high more often than the stop below the sweep." One instrument, one window, one entry. Everything else waits.

### Step 2: turn every word into a rule

```stats
Swing point | 5-bar fractal | High above the two highs on each side
Sweep | ≥ 1 tick beyond, close back inside | On the 5-minute chart
Displacement | Range ≥ 1.5× 20-bar average | Closing beyond the last swing
FVG | ≥ 8 ticks | Candle 1 wick to candle 3 wick
Cancel | Target hit first, or 11:00 a.m. | Whichever comes first
```

The thresholds are examples; the principle is that no condition relies on judgement. If you keep a discretionary element, such as "clean" structure, write down what you mean and accept that results will be harder to reproduce.

### Step 3: replay bar by bar

Use a replay mode that hides future bars. For each day in the test period, step forward one bar at a time, mark conditions as they occur, and log every setup that qualifies, including those that did not fill. Never skip a day because it "looked messy", and never look ahead to decide whether a setup counts. A backtest done by scrolling through finished charts will overstate results, sometimes dramatically.

### Step 4: log the right fields

For each setup, record: date and time, instrument, window, liquidity type swept, entry variant, fill (yes or no), entry, stop, target, exit, result in R, maximum favourable and adverse excursion, and tags for optional confluences (SMT, OTE overlap, news day). These fields let you later ask which ingredient matters without re-running the test.

### Step 5: measure

- **Expectancy in R** and **profit factor**.
- **Win rate** against the **breakeven win rate** for your average win size.
- **Maximum drawdown** in R and the **longest losing streak**.
- **Results by window, liquidity type and entry variant.**
- **Fill rate**, and the results of unfilled setups had they filled.

### Step 6: expect losing streaks

With a 60% loss rate, long streaks are normal. Assuming independent trades, the probability of at least one run of **six or more losses** in 60 trades is about **70%**; of **eight or more**, about **32%**. If your plan cannot survive eight straight 1R losses psychologically and financially, reduce risk per trade before you start, not after the streak arrives.

### Step 7: in-sample, out-of-sample, forward test

Design and tweak rules on one portion of the data (in-sample). Then run the frozen rules on a later, untouched portion (out-of-sample). If results collapse, the rules were fitted to noise. Only after the out-of-sample check, trade the model live at minimum size (a Micro contract, for example) for a defined number of trades, and compare live slippage, fill rate and expectancy with the backtest.

### The advanced nuance: degrees of freedom

Every threshold you tune (fractal length, displacement multiple, gap size, window start, entry variant) is a degree of freedom. Try enough combinations and one will look excellent purely by chance. Keep the number of tuned parameters small, prefer round, sensible values over the single best-performing value, and judge a change by whether it improves results across neighbouring settings too. A model that only works at a 1.53× displacement and fails at 1.4× and 1.7× is fitted, not robust.

```warning
Your own discretion is the hardest bias to remove. If you notice yourself thinking "I wouldn't really have taken that one", log it anyway. The trades you would have skipped are exactly the ones that reveal whether your filter is real or hindsight.
```

### How professionals use the results

A professional treats a backtest as an estimate with error bars. They size so the realistic worst case (a long losing streak and a drawdown larger than the backtest showed) is survivable, they set a review point after a fixed number of live trades, and they write down in advance what result would make them stop trading the model. Your trading journal is the continuation of the backtest: the same fields, the same R measurement, a growing sample.

### Common mistakes

- **Backtesting on finished charts** instead of bar-by-bar replay.
- **Logging only filled or "valid-looking" trades.**
- **Judging an edge on a few dozen trades.**
- **Tuning until the curve looks perfect.**
- **Ignoring costs**: commissions, slippage on stops, and partial fills.
- **Skipping the out-of-sample check** because the in-sample result was exciting.

```tip
Before you start the test, write the stop rule for the model itself: "If out-of-sample expectancy is below +0.1R after 100 trades, the model is retired." Deciding in advance protects you from rescuing a dead model with new conditions.
```

```checklist
title: ICT model backtest protocol
- Write a one-sentence hypothesis: instrument, window, setup, target.
- Convert every condition into a numeric or time-based rule.
- Reserve a later period of data as out-of-sample and do not look at it.
- Replay bar by bar and log every qualifying setup, filled or not.
- Record R, excursions and confluence tags for each setup.
- Compute expectancy, profit factor, drawdown, longest losing streak and a confidence range.
- Run the frozen rules on the out-of-sample period.
- Forward-test at minimum size and compare live results with the test.
```

```quiz
[
  {
    "q": "Win rate 40%, average win 2.4R, losses −1R. What is the expectancy?",
    "options": ["+0.16R", "+0.36R", "+0.96R", "−0.04R"],
    "answer": 1,
    "why": "0.40 × 2.4 − 0.60 × 1 = 0.96 − 0.60 = +0.36R per trade."
  },
  {
    "q": "What is the breakeven win rate for an average win of 2.4R and average loss of 1R?",
    "options": ["About 29%", "About 40%", "About 50%", "About 71%"],
    "answer": 0,
    "why": "Breakeven = 1 ÷ (1 + 2.4) ≈ 29.4%."
  },
  {
    "q": "Why can 60 trades at +0.36R still fail to show an edge?",
    "options": ["Because 60 is an odd number", "Because the 95% range for expectancy can still include zero", "Because R cannot be averaged", "Because win rates above 30% are suspicious"],
    "answer": 1,
    "why": "With a standard deviation near 1.7R, the 95% range is about −0.07R to +0.79R, which includes zero."
  },
  {
    "q": "What is the purpose of the out-of-sample period?",
    "options": ["To tune the parameters further", "To check whether rules designed on other data still work on data they were not fitted to", "To increase the number of winners", "To replace forward testing"],
    "answer": 1,
    "why": "Out-of-sample testing exposes rules that were fitted to noise in the design period."
  }
]
```
