CRTLABCRTLABBacktesting SystemFree to start
FeaturesPricingBlogFAQ
Databento · CoinAPI ·TradingViewLog inStart free
← All articles
Backtesting

How to Write Trading Rules You Can Actually Backtest

Most trading rules can't be tested because they aren't rules. Here's how to write a strategy so precisely that a stranger could replay your week and take the same trades.

Aug 9, 2026·16 min read·Backtesting

Every guide to backtesting starts the same way: step one, write your rules down. Then it moves on, as if that were the easy part. It isn't. It's the part that decides whether the next three weeks of work produce a number you can trust or a number you made up.

Here's what usually gets written down:

Wait for a sweep of liquidity, then look for a strong displacement and a clean shift in structure. Enter on the retracement into the order block or FVG with confluence. Stop below the low, target the next liquidity.

That reads like a strategy. It isn't one. It's a description of a chart pattern you already recognise, written in language that lets you justify almost any trade after the fact. Backtest it and you'll get a lovely result, because at every ambiguous moment you'll unconsciously resolve the ambiguity in the direction the next candle already went.

This is how to write rules that don't do that.

The test that tells you whether you have rules or vibes

Want to try this yourself? Backtest it on real market history in CRTLAB.Start free →

There's one question, and it's brutal:

If you handed your written rules to a trader who has never seen your strategy, and they replayed the same week of price bar by bar, would they take the same trades you would?

Not similar trades. The same ones — same entries, same stops, same skips. If the answer is no, you don't have a strategy you can test. You have a strategy that lives in your head, and the document is a souvenir.

The reason this matters isn't philosophical. A backtest is an attempt to measure one specific thing across a few hundred repetitions. If the thing being measured changes shape between repetition 12 and repetition 80 — because on trade 12 the displacement looked strong enough and on trade 80 it didn't — then your sample isn't 200 trades of one strategy. It's a few dozen trades each of six slightly different strategies, averaged together into a number that describes none of them.

That's also the mechanism behind the most common backtesting failure of all, changing the rules halfway through a test. Vague rules don't prevent that failure — they hide it, because you never notice the rules changed.

The left-hand-data rule

One principle does most of the work here, and it's the one to apply if you only take one thing from this page.

Every condition in your rules must be answerable using only the candles to the left of the current one, at the moment you'd have to act.

That's it. Not "using the chart" — using the left-hand side of the chart, at the specific bar where the decision happens.

Run each of your conditions through it:

  • "A strong displacement move" — can you answer that at the close of the displacement candle, from left-hand data alone? Only if "strong" is defined against something measurable. Strong compared to what? The last 14 candles? A fixed point value? Until you say, the answer is: no, you're grading it against what happened next.
  • "Price respects the order block" — this one fails outright. Whether price respected a zone is only knowable after price left it. As an entry condition it's unusable; as an outcome you're logging, it's fine.
  • "Enter on the retracement into the zone" — passes, as long as you've defined the zone's boundaries and which edge triggers the entry.
  • "Wait for confirmation" — fails until you name the confirming event and the timeframe it has to appear on.

Most untestable rule sets fail this check in exactly two or three places. Find those places and you've found the entire job.

The words that quietly make a rule untestable

These show up in almost every strategy document. Each one is a hole where hindsight gets in.

The word Why it fails What to replace it with
Strong / aggressive move Strong relative to nothing A multiple of ATR(14), or a point/pip threshold for that instrument
Clean / textbook Cleanliness is only visible afterwards Delete it. If it's doing real work, name the specific feature you mean
Obvious / significant level Every level is obvious in hindsight A named level type: prior day high, prior session low, equal highs within N points
Respects / reacts to Describes the outcome, not the trigger A price event: touched the proximal edge, closed back above it, wicked and closed inside
Near / around the zone An unbounded tolerance A number: within 5 points, or within 25% of the zone's height
Wait for confirmation Confirmation is whatever you want it to be The exact event and timeframe: "an M5 close beyond the 15-minute swing high"
With confluence Unlimited licence to justify anything A count: "at least two of [named list]", each individually testable
Healthy pullback Health is retrospective A retracement band: 38–79% of the impulse leg
Quality setup Pure discretion wearing a rule's clothes See the discretion budget below — score it, don't pretend it's objective

Notice the pattern: almost all of them are outcome words used as entry conditions. "Respects", "clean", "healthy" — these describe how the trade turned out, smuggled into the section that's supposed to tell you whether to take it.

The five slots your rules have to fill

A complete rule set answers five questions, in order. If any slot is empty, the gap gets filled in real time by whatever you feel like — which is the definition of an untested variable.

1. Scope. Which instrument, which timeframe, which hours. One market and one timeframe pair for the first test. "Any pair, any timeframe" isn't flexibility, it's an untested variable with an infinite range.

2. Context. What has to be true before you're allowed to look for an entry at all. Directional bias, higher-timeframe structure, session, whether a specific pool has been taken. This slot answers am I allowed to be looking for a long right now?

3. Trigger. The single event that puts you in. Not a region, not a feeling — one event, at one price, on one timeframe. If two different events could both count as your trigger, you have two strategies and you should test them separately.

4. Invalidation. A price, decided before entry, where the idea is wrong. Not a dollar amount, not "when it looks wrong". A price. If you can't name it before you enter, you haven't finished the analysis — the wider case for defining invalidation first is that everything else in the trade is sized off it.

5. Exit. Where you're trying to get to, and what — if anything — makes you leave early. Fixed R, a named liquidity pool, a time stop, a partial rule. "Manage it" is not an exit rule.

Write them as five numbered lines. If a line needs a paragraph, it's hiding an unresolved decision.

A worked rewrite

Here's the vague version from the top of this page, taken apart and put back together. This is the level of specificity that makes a test mean something.

Before:

Wait for a sweep of liquidity, then look for a strong displacement and a clean shift in structure. Enter on the retracement into the order block or FVG with confluence. Stop below the low, target the next liquidity.

After (v1.0):

  1. Scope. NAS100. Context read on M15, entries executed on M5. New York session only, 09:30–11:30 New York time.
  2. Context. The Asian session high or low has been swept: an M15 wick beyond the level, with the candle closing back inside it. The swept level must have formed before 08:00 New York time.
  3. Trigger. After the sweep, price must close an M5 candle beyond the most recent opposing M5 swing point (swing = 3 candles either side). The entry is a limit order at the proximal edge of the first M5 fair value gap left behind by that displacement leg. If price never returns to that edge before hitting target or invalidation, the trade is a no-fill and is logged as such.
  4. Invalidation. One point beyond the extreme of the sweep wick. If that distance exceeds 40 points, the trade is skipped and logged as skipped-too-wide.
  5. Exit. Target is the opposing side of the Asian range. No partials, no break-even stop, no manual exits in version 1.0. Trade closes at 11:30 New York if unresolved, logged as a time stop with the R at close.

Every line in the "after" can be answered with yes or no from left-hand data at the moment it matters. There's exactly one entry per valid setup. Invalidation is a price. And critically, the skip conditions are named and logged, not silently dropped — which is what lets you find out later whether your 40-point filter was helping or quietly deleting your best trades.

The "after" version will also feel worse to trade than the "before" version. That's expected. The vague version feels better because it always finds a way to be right.

Your discretion budget

You do not have to remove all discretion. Most discretionary traders shouldn't, and pretending otherwise is why so many people abandon their plan in week two.

What you have to do is name the discretion and put a number on it.

Pick the one or two places where you genuinely can't articulate the rule — say, "does this displacement look institutional or does it look like chop". Leave them discretionary, but for every setup, log a setup quality score from 1 to 5 alongside everything else. Score it before you know the outcome.

Then, after a hundred setups, check whether your score correlates with the result. There are only three outcomes, and all three are useful:

  • Your 5s materially outperform your 2s. Your discretion is a real edge. Keep it, and consider making it a size rule.
  • There's no relationship. Your discretion is noise. You can delete that judgement call entirely and your results won't change — which is enormously freeing, because it's one less thing to agonise over at 09:31.
  • Your low scores outperform. Rare, and worth taking seriously. Usually it means you're rating "textbook appearance" and the market pays for something else.

This is the honest way to run a discretionary strategy: not by pretending the discretion is mechanical, but by making it the one variable you're explicitly measuring. Everything else stays fixed so the measurement means something.

The rules nobody writes down, that decide the equity curve

Entry rules get all the attention. These get almost none, and they'll move your annual result more than the entry does:

  • Maximum trades per session. Without a cap, a bad morning becomes a bad month. Pick a number.
  • What happens after consecutive losses. Stop for the day at three? Continue as normal? Both are defensible. Not deciding is not.
  • Missed entries. Price ran without you. Do you chase at a worse price, or is it gone? Write the answer down, because in the moment you will chase.
  • News. Do you hold through high-impact releases inside your window, or flatten? Your backtest silently answers this by holding through everything, which is probably not what you'd do.
  • Partial fills and gaps. A limit at the proximal edge that gaps past you is a real event. Decide now whether that's a fill or a no-fill.
  • Concurrent positions. Can two setups be open at once? If yes, your true risk per event is double what you think it is — check what that does to your sizing with the position size calculator.

Every one of these is a rule your backtest applies whether or not you wrote it. The only question is whether you chose it.

Version your rules, and treat a change as a new test

Date your rule set and give it a version number. v1.0 — 2026-08-09. Keep the old versions.

Then hold the line that makes the whole thing work: one change per version, and a change starts a new test at trade one. Not a revision of the current sample — a new sample.

This feels wildly inefficient and it is the only thing that keeps a result honest. If you change the invalidation rule at trade 60 and carry on to 200, you have 60 trades of v1.0 and 140 of v1.1, blended into a single number that describes neither. When you inevitably want to change something at trade 40 — and you will, because that's what the data is for — write it down as v1.1 and finish v1.0 first. The comparison between the two is worth more than either number alone.

There's one exception worth naming: if you discover your rules are genuinely ambiguous — two readings of the same sentence — that's not a strategy change, it's a documentation bug. Fix the wording, note which reading you've been using, and continue. But be honest with yourself about which of the two you're doing.

Know when the rules are finished

Run this checklist before trade one:

  • Could a stranger replay a week and take the same trades?
  • Can every condition be answered from left-hand data at the moment of decision?
  • Is there exactly one entry event per valid setup?
  • Is invalidation a price, decided before entry?
  • Are skips and no-fills logged rather than dropped?
  • Is every discretionary judgement named, and scored 1–5 rather than pretended away?
  • Does the document have a version number and a date?

Seven yeses and you have something worth spending three weeks measuring.

Then go and test them

Written rules are only half of it. The other half is a testing environment that can't leak the future to you — because a rule set this precise is still trivially easy to grade against a chart whose right-hand side you can see.

If the rewrite left you with something genuinely mechanical — every condition a number, no discretionary slots at all — then code it and run it through an automated tester; you'll get a bigger sample in an afternoon than manual replay gives you in a month. That's what MetaTrader's Strategy Tester is built for, and it's free. If any part of it still needs your eyes, you need replay.

You can do that free in CRTLAB: pick one of 38 markets, step through real historical price one candle at a time with the future hidden, and mark entry, stop and target exactly as written. Every trade is logged as you take it — win rate, average R and expectancy build themselves, so the log you promised yourself you'd keep actually gets kept.

From here, the sequence is: how to backtest ICT concepts for turning specific smart-money concepts into countable rules, out-of-sample testing for splitting your history so the result survives contact with reality, and the backtest sample size calculator for how many of these trades you actually need before the number means anything.

Write rules a stranger could follow. Then find out what they're worth.

FAQ

How detailed should trading rules be? Detailed enough that a trader who has never seen your strategy could replay a week of price and take the same trades you would. That's the only standard that matters, and it's higher than most people's rules clear. Practically it usually means five numbered lines — scope, context, trigger, invalidation, exit — with every threshold expressed as a number or a named price level.

Can you backtest a discretionary strategy? Yes, but only by isolating the discretion. Make everything you can objective, name the one or two judgement calls you genuinely can't articulate, and score each setup 1–5 on those calls before you know the outcome. After a hundred setups you can check whether the score predicts anything. If it does, your discretion is an edge; if it doesn't, you can delete it.

What makes a trading rule untestable? Any condition that can only be evaluated after you know what price did next. "Strong move", "clean structure", "price respects the level" and "wait for confirmation" all fail this test, because they're descriptions of an outcome being used as an entry trigger. The fix is always the same: replace the adjective with a measurable threshold or a named price event.

Should I write my trading rules before or after backtesting? Before. The rules are the hypothesis; the backtest is the measurement. If you write the rules by looking at what worked in the data, you haven't tested anything — you've described the past. If the test suggests a change, that's legitimate, but it becomes version 1.1 and needs a fresh sample to evaluate.

How do I stop myself from changing the rules mid-backtest? Version the document, date it, and make a rule that any change starts a new test at trade one. The urge to change something at trade 40 is normal and usually informative — write it down as the next version instead of applying it retroactively. Finishing v1.0 costs you a few days and buys you a number you can actually compare against.

Do I need rules for things other than entries? Yes, and they matter more than most people expect. Maximum trades per session, what happens after consecutive losses, whether you chase a missed entry, whether you hold through news, and whether two positions can be open at once. Your backtest applies an answer to every one of these whether or not you chose it — usually the most permissive answer, which is rarely the one you'd take live.

How many rules should a trading strategy have? Fewer than you think, and each one has to earn its slot. Every condition you add removes setups from your sample: three filters that each keep half of what reaches them leave you with an eighth of your trades. A strategy with ten conditions may be untestable in a human lifetime of history, which makes it indistinguishable from a strategy that doesn't work.

What's the difference between a trading plan and a strategy? The strategy is the five slots — scope, context, trigger, invalidation, exit — for one specific setup. The trading plan is the wrapper: risk per trade, daily limits, which strategies you're allowed to run and when, and the review process. You backtest the strategy. You follow the plan. Confusing the two is why a lot of people have twelve pages of documentation and still no testable rule.

Backtest it yourself — free.

Replay real market history candle by candle across 38 markets. No card required.

Start free →

Keep reading

Backtesting

How Long Does It Take to Backtest a Strategy?

The honest arithmetic of manual backtesting: why most of the hours go on candles where nothing happens, and the three levers that actually cut them down.

Aug 20, 2026·11 min read·Backtesting
Backtesting

How to Backtest a Trading Strategy (The Complete Method)

A complete, honest method for backtesting a trading strategy by hand — writing testable rules, choosing a sample, replaying bar by bar, logging trades, and reading the result without fooling yourself.

Aug 12, 2026·14 min read·Backtesting
Journaling

What to Log in a Trading Journal (The Fields That Actually Change Anything)

Most trading journals record what happened and change nothing. The fields that actually improve your trading — R, MFE, MAE, skipped setups, rule adherence — and how to read them.

Aug 12, 2026·10 min read·Journaling
CRTLABCRTLAB

Trade ten years before you risk a dollar.

@crtlabpro

Product

  • Features
  • Pricing
  • Blog
  • Reference
  • Backtesting software
  • Candle-by-candle replay

Free tools

  • Position size calculator
  • Risk/reward calculator
  • Margin & leverage calculator
  • Pip calculator
  • Compounding calculator
  • Prop firm challenge calculator
  • Backtest sample size calculator
  • Session & kill zone times

Backtest

  • NAS100
  • US30 (Dow)
  • Gold (XAUUSD)
  • Bitcoin (BTCUSD)
  • Forex

Strategy

  • CRT backtester
  • ICT backtesting
  • SMC backtesting

Company

  • Start free
  • Log in
  • Terms
  • Privacy
  • Refunds
  • Risk disclaimer

© 2026 CRTLAB. All rights reserved.

Not financial advice. Backtesting does not guarantee future results.