StructureX

Home › Guides › Practice

How to backtest a trading strategy, step by step

Imagine testing your rules on 100 trades before you risk a cent. That's backtesting: replaying past charts by hand. It's free, and it trains your eye too.

Beginner guide · 9-minute read · Updated 2026-10-21

Replaying a past chart bar by bar: the right side stays hidden, just like real time. An illustration.
Replaying a past chart bar by bar: the right side stays hidden, just like real time. An illustration.

What backtesting is

Backtesting is testing a set of trading rules on past price data. You go back in time, follow your rules exactly, and write down what each trade would have done.

There are two kinds:

This guide is about the manual kind. It's slower, but for a beginner it's better: you're not just testing the rules, you're practicing seeing them.

Step 1: Write your rules down first

You can't test a strategy that lives in your head. Before you open a chart, write rules that someone else could follow without asking you questions.

The test for a good rule: two people reading it on the same chart would take the same trade. If they'd argue, the rule isn't clear enough yet.

A one-page trading plan is a good place to put these.

Step 2: Set up replay on TradingView

TradingView has a Bar Replay tool. You pick a date in the past, and the chart hides everything after it. Then you step forward one candle at a time.

  1. Open your chart and time frame.
  2. Click Replay in the top toolbar.
  3. Click a point in the past to start from.
  4. Use the step-forward button to reveal one candle at a time.

Full walkthrough: TradingView bar replay. Replay features can vary by plan, so check what your account includes.

Step 3: Never peek

This is the rule that makes or breaks a backtest. Don't look at what happens next before you decide.

If you scroll ahead, or you already remember this chart, your brain will "find" the trades that worked and skip the ones that didn't. The results will look great and mean nothing.

Write the trade before the candle moves. Entry, stop and target go in the log first. If it's not written, it doesn't count.

Step 4: Log every trade, including the ugly ones

Each trade gets a row, even the ones you'd rather forget. Track at least:

A trading journal works for this. Our free journal template has the columns ready.

Step 5: Do 100 trades

Ten trades tell you almost nothing. A few lucky ones can make a bad rule look good, and a few unlucky ones can make a good rule look bad.

Aim for 100 trades before drawing conclusions. That's enough to see the shape of the results. Spread them over different months and market moods: some trending, some choppy.

It sounds like a lot. Done in replay, many traders get through 10–20 a session.

Step 6: Measure what matters

When you have your trades, work out:

MeasureWhat it tells you
Win ratehow often trades reached the target
Average win and average loss (units of risk)how big wins are next to losses
Expectancyaverage result per trade, in units of risk
Longest losing streakhow many losses in a row to be ready for
Biggest drawdownthe deepest dip from a high point
Rules followedhow many trades matched the written rules

Expectancy is the headline number: (win rate × average win) − (loss rate × average loss).

See the math (in units of risk): 100 trades, 40 wins averaging +2, 60 losses at −1. Expectancy = (0.40 × 2) − (0.60 × 1) = +0.2 units per trade. That's a math example, not a promise. Past charts don't guarantee future ones, and live results are usually worse than a backtest.

Plug your own numbers into the expectancy calculator.

Common backtesting mistakes

What comes after

A backtest answers "do these rules hold up on the past?" The next step is real time with no money at stake: paper trading. Then, if you choose, very small live size. Each step tests the same rules under a little more pressure.

Try it today

  1. Write your entry rule in one sentence.
  2. Open a daily chart in replay, starting a year back.
  3. Take 10 trades without peeking. Log every one.
  4. Count how many followed your rules exactly.

Questions

How many trades do you need to backtest a strategy?

Aim for about 100. Fewer than that, and a few lucky or unlucky trades can swing the results too much to trust.

Can I backtest for free on TradingView?

TradingView's Bar Replay lets you replay past charts candle by candle. What's included can depend on your plan, so check your account.

Is manual backtesting worth it?

For beginners, yes. It's slower than automatic testing, but you practice spotting your setup on real charts, which is the skill you'll use live.

Why are my live results worse than my backtest?

Common reasons are peeking during the test, ignoring costs, and emotions in real time. That's why paper trading comes between backtesting and live trading.

What is a good expectancy?

Anything above zero after costs means the rules held up on that sample. It's evidence, not a guarantee about the future.

Want the next step? We'll walk you through it.

Four free lessons by email, one every few days — each with a 10-minute exercise on a real chart.

Send Me the Free Lessons 4 short emails · No spam · Unsubscribe anytime

Or see the whole method, step by step:

See What’s Inside the Course Try everything free first. Decide when you're ready. · Open the free chart tool (works in the TradingView phone app)

One chart idea a day, in plain English. Follow along:

Follow on XFollow on TradingView