How to Write Testable Trading Rules You Can Backtest
Reviewed by Leon Moyer - Published October 9, 2026 - Last reviewed October 9, 2026
In this lesson
Rewrite a vague options trading idea as entry, exit and sizing rules precise enough to backtest.
Testable trading rules are written conditions for entering, exiting and sizing a trade that are precise enough for a person or a program to apply to past data and reach the same answer every time. "Buy when XYZ closes above its 50-day average" can be backtested; "buy when XYZ looks strong" cannot.
This lesson is about that one quality. What each strategy's rules should contain is covered in Course 2's lesson How to Write Entry, Exit and Sizing Rules for Each Options Strategy. This module also builds on two Course 3 lessons, How to Find Your Trading Edge: The Journal Fields That Matter and How Many Trades Do You Need? Sample Size and Forward Testing, so read those first if judging results from a journal is new to you. The rest of this module then tests the rules against history, rehearses them on paper and tracks whether you follow them.
What makes a trading rule testable?
A testable rule set fixes the entry, the exits and the size of every trade, with no judgment left over. Each rule has to pass four checks:
- Is it specific? It names a number, a price, a date or an event. "When volatility is high" becomes "when the 30-day implied volatility of XYZ is above 35%."
- Is it checkable? Two people, or a program, reading it on the same day would agree whether it was met. "After a pullback" becomes "after XYZ closes at least 5% below its highest close of the last 20 sessions."
- Is it complete? It says what to do, not only when to look. "Watch for an entry" becomes "buy the spread at the next day's open."
- Was it knowable at the time? It uses only information you would have had when you acted. "Enter at the open if today's close is above the average" fails, because the close does not exist yet at the open.
Anything left to the moment cannot be tested: there is nothing fixed to replay.
How do you turn a vague idea into a testable rule?
These thresholds illustrate precise wording; they are not recommendations. Any number works for testing if it is fixed in advance, and a moving average or any other signal is not an edge by itself. Whether the rules are worth trading is what Backtesting Options Strategies asks.
Two more details make rules replayable. Name the data each rule reads: closing or intraday prices, which implied volatility figure, and what fill you assume. And say what happens when a rule cannot be met, such as no monthly expiration 40 to 50 days out, or an earnings report during the trade. A backtest hits those cases constantly, and an unwritten answer becomes a hidden judgment call.
How do you write exit rules a backtest can check?
Because an option expires and its value moves with time and volatility as well as price, an options strategy needs three exits: a profit exit and a loss exit, each stated as an option or spread price ("close when the spread is worth $3.10", "close when it is worth $0.60"), and a time exit ("close with 21 days left"). Option prices are what you actually sell, and a backtest with real option quotes can check them directly.
A loss exit is a plan, not a guarantee. If the stock gaps overnight, the spread can open below your exit price, so the actual loss can be larger, up to the trade's maximum loss. That is why the sizing rule below uses the maximum loss.
How do you write a sizing rule a backtest can apply?
A sizing rule turns a fixed share of the account into a number of contracts: contracts = the dollars you will risk divided by the maximum loss of one contract or spread, rounded down.
That needs defined risk, where the most you can lose is known at entry. Undefined-risk strategies, such as a short call with no shares behind it, have no fixed maximum loss to divide by and need a different, more careful basis.
Worked example
Example: sizing an XYZ bull call spread by rule
XYZ trades at $50 and has just closed above its 50-day average, so the entry rule is met. The rules say to buy a bull call spread: long the lower-strike call, short the higher one, same expiration.
- The spread: at hypothetical quotes, buy the XYZ 50 call for $2.00 and sell the XYZ 55 call for $0.80, both with 45 days left. The net cost, or debit, is $2.00 - $0.80 = $1.20 a share, or $120 per spread.
- Maximum loss: $120 per spread, if XYZ is at or below $50 at expiration and both calls expire worthless.
- Maximum profit: the $5 gap between strikes minus the debit, ($5.00 - $1.20) x 100 = $380 per spread, if XYZ is at or above $55 at expiration.
- Break-even at expiration: the lower strike plus the debit, $50 + $1.20 = $51.20.
- The sizing rule: risk at most 2% of a $20,000 account, which is $400. Contracts = $400 / $120 = 3.33, rounded down to 3 spreads. Three spreads risk $360.
- The exits: profit exit when the spread is worth $3.10 (the $1.20 paid plus half the $3.80 maximum gain), loss exit at $0.60 (half the debit), and a time exit with 21 days left.
Illustrative and hypothetical. The ticker and prices are invented for teaching, and the figures exclude commissions, fees, margin interest and taxes, which reduce real results. Past or hypothetical outcomes do not indicate future results.
The XYZ 50/55 bull call spread, sized by the rule, at expiration
Hover or tap the chart, or focus it and use the arrow keys, to read any price.
Open this trade in the free calculatorShow as table
Sized from the maximum loss, three spreads lose $360 at worst, under the $400 limit, whatever the stock does. Results are before fees.
A rule set for one strategy, from entry to exit
Entry
XYZ closes above its 50-day average; 40-50 days to expiration
Size
floor($400 / $120 max loss) = 3 spreads
Price exits
Close at $3.10 ($1.20 debit + half the $3.80 max gain) or $0.60 (half the debit)
Time exit
Close with 21 days left if neither is hit
How do you know your rules are ready to backtest?
Hand them to someone else. If they would open the same contract, at the same size, and close it at the same moment you would, the rules are finished. If they would have to ask you anything, that question marks the rule that still needs a number in it.
Then count the numbers in your rules. Each threshold is a dial a backtest could tune, and the more dials you have, the easier it is to fit the past by accident. Write the rules down before you look at any results, which is the first defense against the overfitting covered in Backtesting Options Strategies.
Options involve risk and are not suitable for every investor. Spreads involve more than one commission and can be assigned early on the short leg. Read Characteristics and Risks of Standardized Options before trading them.
Check your understanding
Rewrite this as a testable rule: 'Buy calls when the stock looks oversold.'
Show answer
One version: 'Buy when XYZ closes at least 5% below its highest close of the last 20 sessions.' Any version works if it names a number and two people would agree whether it was met.
Your rule risks $400 a trade. A spread's maximum loss is $150. How many spreads does the rule allow?
Show answer
Two. $400 / $150 = 2.67, rounded down to 2, which risks $300.
A rule says: 'Enter at the open if today's close is above the 50-day average.' Why can it not be tested as written?
Show answer
It uses information that does not exist yet: the close comes hours after the open. Rewrite it to enter at the next session's open after a close above the average.
Key takeaways
- A testable rule is specific, checkable, complete and uses only what you knew at the time.
- Name the data each rule reads and what happens when a rule cannot be met, or a backtest hides judgment calls.
- Options need profit, loss and time exits, stated as option prices; size from the maximum loss, rounded down.
- Write the rules, with as few numbers as possible, before you look at results.
Common questions
What makes a trading rule testable?
A testable rule is specific (it names a number, a time or a price), checkable (two people, or a program, would agree whether it was met), complete (it says what to do) and uses only information available when the decision is made. If a rule contains words like strong, cheap or looks, it is not finished.
What is systematic trading?
Systematic trading means placing and closing trades by written rules rather than by judgment in the moment. Each rule is precise enough to check with a yes or no, so the same market conditions always lead to the same decision.
Can you backtest any trading rule?
Only rules that can be applied to historical data without judgment. A rule that depends on a feeling, or on how you would read the news in the moment, cannot be replayed on past data, so a backtest of it really tests your hindsight.
Is systematic trading better than discretionary trading?
Neither is better by default. Systematic rules can be tested and followed consistently, which makes results easier to learn from; discretion can adapt to things rules miss. Many traders use rules for size and exits even when the entry involves judgment.