◆ In one paragraph
A useful backtest of a Smart Money Concepts strategy is a manual, forward-walked replay of at least a hundred setups, logged with the same rules you will trade live, measured by expectancy and drawdown rather than win rate, and then confirmed on a period the rules never saw. Automated backtests of discretionary SMC rules are nearly always over-fitted; bar replay on TradingView with a written rulebook and a spreadsheet is slower and is the only version whose numbers survive contact with a live account.
The first half covered why most backtests are worthless, the forward-walk method, target numbers and the biases. This half is the working procedure: how to write rules tight enough to test, the exact replay routine, the logging template and the formulas, how to read the results without fooling yourself, when a strategy passes and when it fails, what to do about Pine Script strategies and their limits, and one complete test from rulebook to verdict.
Rules tight enough to test
A strategy cannot be backtested until every decision in it is a yes-or-no question that two people would answer the same way from the same chart. "Enter at the order block after a sweep" is not a rule; it is a description. Here is the same idea as rules.
| Decision | Description (untestable) | Rule (testable) |
|---|
| Bias | Higher-timeframe trend is up | The last 4-hour structure event was a break of structure upward, and price is below the midpoint of the 4-hour dealing range |
| Sweep | Price took the liquidity | A 15-minute candle traded beyond the Asian range low or the previous day's low and closed back above it |
| Displacement | A strong candle | Within nine 5-minute candles of the sweep, a 5-minute candle with a body ≥ 2× the 20-bar average body closed above the last 5-minute lower high |
| Entry | At the order block | Limit at the 50% of the fair value gap the displacement candle left; if no gap, at the high of the last down-close candle before it |
| Stop | Below the sweep | 2 pips below the sweep low |
| Targets | The next liquidity | TP1 at the Asian range high, 50% off; TP2 at the previous day's high; trail under confirmed 15-minute higher lows after TP1 |
| Time stop | If it goes stale | Move the stop to entry at 11:00 UTC if TP1 is not reached; close at 16:00 UTC regardless |
Write yours in that format before opening a chart. Every ambiguity you leave in will be resolved differently on winning and losing days in replay, and that is how a 40% strategy tests at 65%. The building a trading system lesson has a template for the full rulebook.
The replay routine
TradingView's bar replay tool is the right instrument because it hides the future. The routine below produces a clean sample in around fifteen hours for a hundred setups on a session-based intraday strategy.
- Pick the period blind. Choose a start date at least six months back without looking at the chart first. Do not choose a period because you remember it trending.
- Set up the chart once. Three timeframes as the rulebook specifies, session boxes drawn, no indicators the rulebook does not name. Save the layout; every replay session uses the same one.
- Step to the session start. Advance the replay to 07:00 UTC of the first day. Mark the Asian range and yesterday's extremes. Write the bias in the log before stepping further.
- Step candle by candle through the window. At each 5-minute candle, ask the rules in order: sweep? displacement? shift? If all yes, the entry, stop and targets are already defined; write them down and keep stepping to see what fills.
- Log every setup, including the ones the rules rejected. A setup that had a sweep and no displacement is a row with "no trade — no displacement". These rows are how you later find out whether the displacement filter is earning its keep.
- Stop at the session end, log, and step to the next day. Never scroll back to look at how a trade "would have" gone with a different stop. That is the beginning of curve-fitting.
The bar replay lesson walks through the tool's controls, and the TradingView backtesting guide covers the plan limits on replay depth.
The log and the formulas
Twelve columns are enough. Date, session, bias, setup type (sweep of what), taken or rejected (and why), entry, stop, TP1, TP2, exit price, exit reason (TP1 / TP2 / trail / stop / time), R result. From those, the spreadsheet computes everything that matters:
- Expectancy per trade = (win rate × average win in R) − (loss rate × average loss in R). The single number that says whether the strategy makes money. Below 0.2R is not worth the screen time; the glossary entry shows the derivation.
- Maximum drawdown in R = the largest peak-to-trough fall in the cumulative R curve. This decides your position size, not your win rate. A strategy with a 12R drawdown at 1% risk is a 12% drawdown; at 2% it is 24%.
- Longest losing streak — count it. You will meet it live, and you need to have seen the number before you do.
- Profit factor = total R won ÷ total R lost. Above 1.5 is workable; above 2.5 on a hundred trades is usually a sign of an error somewhere.
- Expectancy by sub-group — by session, by pair, by setup type, by day of week. This is where you find that Friday London setups lose and everything else wins, or that sweeps of the Asian range pay and sweeps of yesterday's low do not.
Also compute the confidence you are entitled to. A 55% win rate on 100 trades has a 95% interval of roughly 45–65%; on 30 trades it is 37–73%, which is the difference between a good strategy and a coin. The Wilson score entry has the formula.
Reading the results without fooling yourself
A good result should be met with suspicion first. The sequence of questions, in order:
- Is the sample big enough? Under 100 trades: no conclusion, keep testing. 100–200: a provisional yes if expectancy is above 0.3R and the confidence interval on the win rate excludes the break-even rate. 200+: workable.
- Is the equity curve smooth or is one month doing all the work? Plot cumulative R by month. If two months of a nine-month test produced 80% of the profit, the strategy works in one regime and you have not tested the others.
- Did the rejected setups lose? Look at the "no trade" rows and ask what they would have done. If the setups the displacement filter rejected would have won as often as the ones it accepted, the filter is decoration. If they would have lost, it is the strategy.
- Does the drawdown match the win rate? A 60% win rate with a 1.5R average winner should produce losing streaks of six or seven at some point in 200 trades. If the longest streak is three, something in the logging is flattering the strategy.
- Would you have taken every trade? The replay was calm. Live, at 08:20 UTC with a position open on another pair, would you have placed the limit? If the honest answer is no for a third of the trades, the tested expectancy is not yours.
The lookahead bias entry and the backtesting guide list the other ways a test flatters itself.
Pass, fail and the out-of-sample check
A strategy passes the first stage when it has at least 100 trades, expectancy above 0.3R, a profit factor between 1.5 and 2.5, a drawdown you could actually sit through at your intended risk, and a monthly R curve that is positive in at least two thirds of months. It fails if any of those is missing, and the response to a fail is not to tweak the rule that would have fixed the worst month; it is to ask whether the idea itself is wrong.
A strategy that passes then goes to a period it never saw: a different six months, ideally with a different regime — a ranging period if the test was trending. Same rules, no changes, same log. If the out-of-sample expectancy is within about half of the in-sample figure, the strategy is real. If it collapses, the in-sample result was fitted to the period, and the strategy goes back to the drawing board no matter how good the first number looked.
◆ The one-change rule
If you change a rule after seeing results, the test starts again from zero on a fresh period. Every rule change made in response to results is a degree of freedom, and enough of them will fit any strategy to any period. One change, one new test.
Pine Script strategies: what they can and cannot tell you
A Pine Script strategy on TradingView can run thousands of trades in seconds, which is why it is so tempting. For SMC it has two limits. First, the discretionary parts — which swing is protected, whether a candle is displacement, which block is the one — must be reduced to fixed numbers, and the numbers you pick will be the ones that made the last test look good. Second, the strategy tester fills at bar closes and assumes fills at the limit price; on a 5-minute sweep entry the difference between that and reality is most of the edge.
Use Pine strategies for what they are good at: testing one mechanical component of the method — does a 2× body displacement filter beat a 1.5× one over five years? does a 2-pip stop buffer beat a 5-pip one? — with the rest of the setup fixed. Treat the absolute numbers as unreliable and the comparisons as useful. Then confirm the winning component in manual replay. The Pine Script guide shows how to build a minimal strategy, and Zeno's non-repainting signals can be back-tested on their own terms because the signal is fixed at the confirmed bar.
One test, rulebook to verdict
Strategy: the EUR/USD London sweep from the rulebook table above. Period: six months, chosen by picking a start date from a calendar without looking at the chart. Replay: one session a day, roughly 130 trading days.
- Setups logged: 178. Sweeps with no displacement within nine candles (rejected): 61. Trades taken: 117.
- Win rate to TP1: 58% (68 trades). Confidence interval roughly 49–67%. Of the 68, 31 reached TP2 or better via the trail.
- Average winner: 1.7R. Average loser: 0.94R (a few time-stop exits at small losses). Expectancy: 0.58 × 1.7 − 0.42 × 0.94 = +0.59R per trade.
- Total: +69R over six months. Max drawdown 9.4R. Longest losing streak: 7. Profit factor 2.1.
- By month: positive in five of six. The negative month was a low-volatility August with 11 trades and −4R.
- Rejected setups, had they been taken: 38% would have reached TP1. The displacement filter is doing real work.
Verdict: pass stage one. Out-of-sample: a different six months, chosen the same way, produced +0.41R per trade over 104 trades with a 7.8R drawdown. Within half of the in-sample figure; the strategy is real. Position size from the drawdown: at 1% risk the tested worst case is a 9.4% drawdown, which the trader can hold; at 2% it would be 19%, which they could not. Go live at 1% on a small account, and keep the same log, because the live journal is the third test — the journal system lesson picks up from here.
The playbook
- Write every decision as a yes-or-no rule before opening a chart. Bias, sweep, displacement, entry, stop, targets, time stop. If two people would answer differently, it is not a rule yet.
- Replay a blind-chosen period candle by candle on the rulebook's timeframes. Log every setup, taken or rejected, with the reason. Never scroll back.
- Compute expectancy, drawdown, longest streak, profit factor and the win-rate confidence interval. Break expectancy down by session, pair, setup type and weekday.
- Pass only on: 100+ trades, expectancy > 0.3R, profit factor 1.5–2.5, drawdown you can hold, two thirds of months positive. A fail means the idea is questioned, not the worst month patched.
- Confirm on an unseen period with no rule changes; then go live at the size the drawdown allows. One change to any rule restarts the test on a fresh period.
Mistakes that cost the most
- Testing a description instead of a rulebook, and resolving the ambiguities in the strategy's favour on every losing day.
- Choosing the test period after looking at the chart.
- Scrolling ahead in replay to see how a trade would have gone with a different stop.
- Declaring a strategy proven on 30 trades, where a 55% win rate is statistically indistinguishable from 40%.
- Sizing from the win rate rather than the drawdown. Drawdown is what ends accounts.
- Trusting a Pine strategy tester's absolute numbers on a discretionary SMC setup. Use it for comparisons between components only.
- Changing three rules after the first result and re-running on the same period. That is fitting, not testing.
Key takeaway
A backtest is only as good as the rulebook it tests and the discipline of the replay. Write rules two people would apply identically, replay a blind period one candle at a time, log every setup including the rejected ones, and judge the result by expectancy, drawdown and the confidence interval rather than the win rate. Pass on a hundred-plus trades, confirm on a period the rules never saw with no changes, and size the live account from the tested drawdown. The strategy that survives that is one you can actually trade through its losing streak, because you have already seen it.
Frequently asked questions
How do you backtest a trading strategy properly?
Test at least 50–100 trades per setup across varied conditions, measure win rate together with reward-to-risk and expectancy, and avoid hindsight bias and curve-fitting — ideally using candle-by-candle replay rather than scanning history.
How many trades do I need to backtest a strategy properly?
At least 100 to draw a provisional conclusion, and 200 or more before relying on it. The confidence interval on a win rate shrinks with sample size: 55% on 30 trades could really be anywhere between 37% and 73%, while on 100 trades it narrows to roughly 45–65%. Below 100 trades, a good result and a coin are hard to tell apart.
Can I backtest Smart Money Concepts with a Pine Script strategy?
Only the mechanical components. The discretionary parts of SMC — which swing is protected, whether a candle counts as displacement, which order block is the one — have to be reduced to fixed numbers, and those numbers end up fitted to the test period. Use Pine strategies to compare one component against another (a 2× versus 1.5× displacement filter, say) with everything else fixed, treat the absolute figures as unreliable, and confirm the winner in manual bar replay.
What is the most important metric in a backtest?
Expectancy per trade — win rate times average win minus loss rate times average loss, in R — because it says whether the strategy makes money at all, and maximum drawdown in R, because it decides how much you can risk per trade. Win rate on its own is close to meaningless: a 40% strategy with 3R winners beats a 65% strategy with 0.8R winners, and the second one has the smoother-looking journal.
What is out-of-sample testing and why does it matter?
It means re-running the finished rules, unchanged, on a period of data they were never developed or tuned on — ideally one with a different market regime. If the expectancy on that period is within about half of the original figure, the strategy is real; if it collapses, the original result was fitted to its period. Any rule change made after seeing results turns the current period into in-sample data, so the out-of-sample check has to be repeated on a fresh period.