7-day free trial on every planCancel before day 7 and you are not chargedStart free →
MENU
Join the free Telegram channelOne free signal a day · no card
9.6 Risk · lesson 68 of 85
Module 9 · RiskBeginner6 of 7 in this module~9 min read

HOW TO BACKTEST A STRATEGY BY HAND

Education Risk ~9 min read Updated 2 December 2026
The short answer

A backtest by hand is a fair test only if you could not see the future. Write the rules before you look at a chart. Hide the later candles with bar replay and decide only on a closed candle. Log every trade, one row each, with its costs: at a teaching 1.2 pips a round trip, 100 trades pay 120 pips. Aim for 100 trades or more across more than one kind of market. Build on the first two-thirds of your history and test the last third once, never adjusting on it.

T
Written by the Trade To The Top team|Reviewed 2 December 2026
Method follows standard out-of-sample testing practice; see also Lesson 9.7 — Backtest vs live for why live results usually come in lower. Cost figures are teaching numbers.

Scrolling back and spotting setups isn’t a backtest. This lesson runs a fair test by hand — rules first, the future hidden, every trade logged.

Key takeaways
In this lesson
Before this Read Lesson 9.5 — How to know if a strategy is working first.

Step 1 — Write the rules before you look

A backtest tests rules, not your eye. Before you open a chart, write down exactly what has to happen for an entry, where the stop goes and why, where the target goes, and the filters that decide when you do not trade. Write them so that someone else could follow them and take the same trades.

If a rule needs your judgement on the day, it is not a rule yet

Judgement in a backtest is hindsight: you already know what happened next, so your “judgement” quietly picks the winners. Fix every choice in writing first, then let the chart decide.

RuleWrite it like this (teaching example)Not like this
EntryA 1-hour candle closes above the range high“Price looks strong”
StopBack inside the range, plus a buffer of 1.5× the hourly ATR“A sensible distance”
TargetTwice the stop distance“Let it run if it feels good”
FiltersEURUSD and GBPUSD only; 7:00–11:00 New York time; no trade 30 minutes either side of tier-one news“When the market is clean”
Size1% of the balance at the stop (Lesson 9.1)“Bigger when I’m confident”
Common mistake

Peeking ahead. Scrolling right to "check" a setup turns the test into a memory. Once you have seen where price went, every borderline entry gets read in its favour. Use bar replay, decide on the closed candle only, and log the trade before you move forward.

Step 2 — Hide the future with Bar Replay

Scrolling back through a chart shows you every result at once. TradingView’s Bar Replay hides the candles after a point you choose and plays history forward one candle at a time, so you decide with only what you could have seen.

ONE CANDLE AT A TIME
EURUSD 1H · bar replay · teaching drawing
Bar replay hides the candles after the replay pointEURUSD 1-hour candles up to a dashed replay line; everything to its right is hidden until you press play.1.08101.08271.08451.08631.0880REPLAY · NOWHIDDEN UNTIL YOU PRESS PLAY
You decide here — before the next candle exists.
How to start a replay on TradingView
1. Open the chart
Pick the pair and the timeframe your rules use
2. Click Replay
In the top toolbar; the replay panel opens
3. Choose a start
“Select date”, the first available day, or a random bar
4. Step or play
One bar at a time, or play at a chosen speed (Shift + ↓ starts and pauses)
5. Decide on closed candles
Only when a candle has closed — then step on
6. Your drawings stay
Indicators and drawings keep working in replay

How far back you can replay intraday charts depends on your TradingView plan; daily charts go back much further. Bar Replay does not work on every chart type (for example spread and tick charts).

Step 3 — Log every trade, costs included

Every setup your rules trigger goes in the log — including the ugly ones you would rather skip. One row a trade, filled in at the moment of the decision, not afterwards.

ColumnWhat goes in itWhy
Date and timeWhen the setup appeared (New York time)Sessions and news change results
SetupWhich rule triggeredCompare setups later
Entry and stopThe prices, from the rulesProves the rules were followed
CostsSpread and commissionThe test pays what live pays
Rules followed?Yes or noA “no” tests you, not the strategy (Lesson 9.5)
One log row — a teaching example
Date
Tuesday, 9:00 New York
Setup
Range breakout, EURUSD 1H
Entry · stop
1.0842 · 1.0830 (12 pips)
Costs
1.2 pips (spread 0.6 + commission 0.6)
Rules followed?
Yes

Step 4 — Charge the costs on every trade

Costs = trades × round-trip cost 100 × 1.2 pips = 120 pips
Teaching numbers from Lesson 8.5; use your own broker’s spread and commission.
Costs in pips — teaching numbers
One trade
1.2
100 trades
120

A test without costs is a different, easier strategy. Add swap for trades held overnight and wider spreads around news (Lesson 9.7 covers the gap between a test and live trading).

Step 5 — Enough trades, more than one market

✓ A test you can read
Trades100 or more
MarketsA trend, a range, a news month
Setups skippedNone
READABLE enough to start judging
✗ A test that fools you
Trades20
MarketsOne strong trend
Setups skippedThe ugly ones
NOISE under about 50 trades is mostly noise

The sample sizes match Lesson 9.5: under about 50 trades the average is mostly noise, 100 is a minimum, 150–300 is better. “A trend, a range and a news month” is an example of variety, not a fixed rule.

Step 6 — Hold some data back and test it once

Split your history before you start. Build and adjust on the first two-thirds. Then test the last third once, with the rules frozen. If you change a rule after looking at that last third, it is no longer a fair test — it has become part of the building data.

BUILD, THEN TEST ONCE
Your history · oldest to newest
Build on the first two-thirds, test once on the last thirdA time bar from oldest to newest: the first two-thirds are for building and adjusting, the last third is tested once.BUILD AND ADJUSTTEST ONCEOLDEST2/3NEWEST
The held-back part is your out-of-sample test.

The three traps

Why tweaking is so dangerous

Bailey, Borwein, López de Prado and Zhu (2014) showed that the more versions of a strategy you try on the same data, the more likely the best-looking one is simply fitted to noise — and it can do worse than nothing out of sample.

TrapWhat it looks likeThe fix
Look-aheadEntering at a candle you could not have seen yet, e.g. the close of the signal candleBar Replay; decide on closed candles only
TweakingChanging settings until the past looks goodHold the last third back; count how many versions you tried
SkippingLeaving out setups that look uglyLog every setup the rules trigger

The rules

The rules — a fair hand backtest
01
Rules first. Entry, stop, target, filters and size, written before you open a chart.
02
Hide the future. Bar replay, one closed candle at a time.
03
Log everything. Every setup, costs included — the ugly ones too.
04
Enough trades. 100 or more, across more than one kind of market.
05
Hold data back. Build on two-thirds; test the last third once and never adjust on it.

Frequently asked questions

How do I avoid seeing the future in a manual backtest?

Use bar replay, decide only on closed candles and log each trade before moving forward.

How many trades do I need?

100 or more, across more than one kind of market.

Should I include costs in a backtest?

Yes, on every trade. At 1.2 pips a round trip, 100 trades cost 120 pips.

What is the held-back data for?

Build the rules on the first two-thirds of your history, then test the last third once, without adjusting.

When this fails

When this fails
  1. Too few trades. Twenty setups is noise, not a test.
  2. One kind of market. A test that only saw a trend.
  3. Rules changed mid-test. Start the count again.
  4. No costs. 100 trades hide 120 pips.
In one box
Use the journal as your log. The free trading journal (also as a spreadsheet) has a row per trade with costs and R — the same columns a backtest needs.
Open journal →
CHECK YOUR UNDERSTANDING
6 questions · immediate feedback · retake any time
Question 01 of 06
When do you write the rules?
Correct: C. Rules first, or you fit them to what you saw.
Question 02 of 06
How do you hide the future?
Correct: D. Bar replay shows one candle at a time, so you decide before you see what happened next. Zooming out or changing timeframe still shows you the outcome.
Question 03 of 06
What goes in the log?
Correct: A. Every trade the rules give you, with spread and commission included. Logging only the good trades, or skipping the ones you do not like, makes the result look better than it is.
Question 04 of 06
How many trades?
Correct: B. Under about 50 is mostly noise.
Question 05 of 06
You changed a rule mid-test?
Correct: B. Two strategies can’t share one log.
Question 06 of 06
Why test the last third of your history only once?
Correct: D. If you adjust the rules after seeing the held-back data, it stops being an honest test. Build on two-thirds, test the last third once.
Module 9 · 6 of 7 in this module
Finished this lesson?
Mark it complete to track your place in the course. Finishing the quiz above marks it too. Progress is saved in this browser only.