Tier 3 · Practitioner · Module 3.4
Manual backtesting on TradingView
Test your written strategy on historical charts, bar by bar, without hindsight — how to prepare, run, record, and analyse a manual backtest of 100+ trades.
Lesson 1 of 3 · 6 min read
Your strategy is written down. Now the question that matters most: would it have made money? A manual backtest answers that by applying your rules to historical charts, one candle at a time, exactly as if you were trading live. It's slow, and it's honest work — and it's the fastest way to learn more about your strategy in a week than you would in months of live trading.
What you'll learn
- The testing pipeline: in-sample, out-of-sample, and forward testing
- How to prepare a backtest: rules, data range, and recording sheet
- How to run a bar-by-bar backtest without hindsight bias
- What to record for every trade
- How to read the results — and how many trades you need
1. Where backtesting fits
- In-sample backtest — test (and cautiously refine) your rules on one block of history.
- Out-of-sample test — freeze the rules and test them on a different block of history you haven't looked at.
- Forward test — trade the rules on a demo account in real time (the last lesson of this module).
Each stage asks a different question. Skipping stages is how traders go live with strategies that only worked in hindsight.
2. Preparation
Rules. Use your written strategy, with a version number (see Entry, stop, and target rules). If you catch yourself making a decision the rules don't cover, stop and write a rule for it.
Data range. Aim for enough history to include different market conditions — trending and ranging periods, quiet and volatile ones. As a guide:
- Enough to produce at least 100 trades for the in-sample test
- Keep a separate, later block of history untouched for the out-of-sample test
Recording sheet. A spreadsheet with one row per trade:
| Column | Example |
|---|---|
| Trade # | 17 |
| Date / time | 2025-03-12 08:00 |
| Direction | Long |
| Setup notes | H4 pin bar at D1 support |
| Entry / stop / target | 1.0875 / 1.0851 / 1.0923 |
| Risk (pips) | 24 |
| Result (R) | +2.0 |
| Rule questions | None |
| Screenshot link | … |
Recording in R (see Stop-loss / take-profit logic) keeps results independent of account size.
3. Running the test without hindsight
The biggest threat to a manual backtest is hindsight bias — seeing what happened next and letting it influence your decisions.
TradingView's Bar Replay tool helps: you choose a starting point, the chart hides everything after it, and you step forward one candle at a time. (Replay features and available timeframes depend on your TradingView plan; other platforms offer similar tools.)
The process
- Pick a random starting date in your data range.
- Step forward candle by candle.
- At each close, ask only: "Do my rules say to act now?"
- When a trade triggers, record entry, stop, and target before stepping forward.
- Step forward until the trade exits according to your rules. Record the result.
- Repeat until you reach the end of the range.
Include costs. Subtract the typical spread (and commission) from each trade, or record entries at the ask for longs. A strategy that's barely profitable before costs is usually unprofitable after them.
4. Reading the results
Once you have 100+ trades, calculate:
| Metric | Formula | Tells you |
|---|---|---|
| Win rate | Winners ÷ total trades | How often you win |
| Average win / loss (R) | Mean R of winners / of losers | The payoff profile |
| Expectancy | (Win rate × avg win) − (loss rate × avg loss) | Average R per trade — the key number |
| Profit factor | Gross profit ÷ gross loss | Above 1 = profitable; higher = more margin for error |
| Maximum drawdown (R) | Largest peak-to-trough fall in cumulative R | The worst stretch you must be able to survive |
| Longest losing streak | Most consecutive losses | What the bad weeks will feel like |
Worked example
(Illustrative backtest of 120 trades.)
- 46 winners averaging +2.1R; 74 losers at −1R
- Win rate: 46 ÷ 120 = 38.3%
- Expectancy: (0.383 × 2.1) − (0.617 × 1) ≈ +0.19R per trade
- Profit factor: (46 × 2.1) ÷ (74 × 1) = 96.6 ÷ 74 ≈ 1.31
- Maximum drawdown: −11R · Longest losing streak: 9 trades
Interpretation: a modest positive edge. At 1% risk per trade, the worst drawdown in the test was about 11% — and live drawdowns are often worse than backtested ones. The trader must be comfortable with 9 losses in a row before going further.
5. Sample size
Small samples lie. With 20 trades, a few lucky winners can make a poor strategy look brilliant — and vice versa.
- Under 30 trades: anecdotes, not evidence
- 100+ trades: a reasonable starting point for a decision
- More, across different conditions: better
If your strategy only produces a handful of trades a year on one market, test it on more markets or a longer history before trusting it.
6. Refining without fooling yourself
It's fine to learn from the in-sample test and improve the rules. But every change you make to fit past data increases the risk of overfitting (next lesson).
- Make few, logical changes with a clear reason ("most losses occurred in the last hour of New York — liquidity is poor then").
- Re-run the in-sample test after each change.
- Then run the out-of-sample test with rules frozen. If results collapse, the changes were probably fitting noise.
Common beginner mistakes
- Hindsight bias — peeking ahead or skipping trades that failed.
- Ignoring costs.
- Drawing conclusions from 20–30 trades.
- Testing only one market condition (for example, a single strong trend).
- Changing rules during the test without restarting it.
Key terms
| Term | Meaning |
|---|---|
| Backtest | Applying strategy rules to historical data to estimate performance |
| In-sample / out-of-sample | Data used to develop rules / unseen data used to validate them |
| Bar Replay | A tool that hides future candles and steps through history one bar at a time |
| Hindsight bias | Letting knowledge of what happened next influence decisions |
| Profit factor | Gross profit divided by gross loss |
| Maximum drawdown | Largest peak-to-trough fall in cumulative results |
Practice
- Set up a recording sheet with the columns above.
- Choose your data range: an in-sample block for 100+ trades and a later out-of-sample block you won't look at yet.
- Run the in-sample backtest using Bar Replay (or your platform's equivalent), recording every trade, including costs.
- Calculate win rate, average win and loss, expectancy, profit factor, maximum drawdown, and the longest losing streak.
Quick recap
- Test in stages: in-sample → out-of-sample → forward test.
- Prepare written rules, enough data for 100+ trades, and a recording sheet in R.
- Use bar replay and record every trade — hindsight bias is the enemy.
- Include costs; judge the strategy on expectancy, profit factor, and drawdown.
- Refine sparingly, then validate on unseen data with rules frozen.
Educational content only — not financial advice. Trading involves substantial risk of loss. Practise on a demo account before risking real money.
