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
Write the rules first: entry, stop, target, filters, size.
Bar Replay hides later candles; decide on closed candles only.
Log every setup, costs included — including the ugly ones.
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.
Rule
Write it like this (teaching example)
Not like this
Entry
A 1-hour candle closes above the range high
“Price looks strong”
Stop
Back inside the range, plus a buffer of 1.5× the hourly ATR
“A sensible distance”
Target
Twice the stop distance
“Let it run if it feels good”
Filters
EURUSD 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”
Size
1% 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
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.
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
READABLEenough to start judging
✗ A test that fools you
Trades20
MarketsOne strong trend
Setups skippedThe ugly ones
NOISEunder 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
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.
Trap
What it looks like
The fix
Look-ahead
Entering at a candle you could not have seen yet, e.g. the close of the signal candle
Bar Replay; decide on closed candles only
Tweaking
Changing settings until the past looks good
Hold the last third back; count how many versions you tried
Skipping
Leaving out setups that look ugly
Log 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
Too few trades. Twenty setups is noise, not a test.
One kind of market. A test that only saw a trend.
Rules changed mid-test. Start the count again.
No costs. 100 trades hide 120 pips.
In one box
Rules: written first
Replay: one closed candle at a time
Log: every trade, costs in
Sample: 100+, several markets
Hold back: the last third, tested once
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.
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.
Every backtest overstates live results. Here are the five sources of decay, how much to discount each one, and how to build a test you can actually trust.