Turning an idea into a testable rule set

Learn how to turn a vague trading idea into entry, exit, risk, filter and failure rules that can actually be backtested, with a worked sizing example.

Part of the Backtesting and Research track on Agenticks. About 11 minutes, written for a advanced reader.

Read first: What is backtesting, Why a strategy screenshot proves almost nothing.

Last reviewed .

Risk notice. Backtested and hypothetical results are simulated: no trades were placed, the rules were applied to past data with the benefit of hindsight, and they may not reflect liquidity, slippage or every cost. Past results, real or simulated, do not predict future results.

Key takeaways

You have an idea. Maybe it is "price tends to bounce off the prior day's low in the first hour." That is a hunch, not a strategy. A hunch lives in your head, where you get to decide after the fact whether each example counted. A rule set is the same idea written down so precisely that a computer, replaying history bar by bar, would take exactly the trades you would, with no judgment calls. The whole point of a backtest is to remove your opinion from the loop, and that only works if the rules leave nothing to interpret.

Five parts make an idea testable

A complete rule set answers five questions: Entry (what exact condition puts you in a trade), Exit (what takes you out, both for profit and for a loss), Risk (how much you lose if you are wrong, on every single trade), Filters (the conditions that must be true before you even look), and Failure conditions (what would tell you the whole idea is broken). Miss any one and your test is either impossible to run or quietly dishonest.

Start with entry and exit, because they are where vague language hides. "Buy when it looks strong" is not testable. "Buy at the open of the first bar that closes above yesterday's high" is. The same goes for the way out. You need a profit exit and a loss exit, and they must be specific: a price level, a number of bars, a percentage, or a multiple of your risk. If you cannot say in one sentence what gets you in and what gets you out, you do not have a rule yet, you have a feeling.

Risk is the part beginners skip and professionals obsess over. Before you think about profit, decide what one loss costs. Fixing risk per trade lets you measure results in R-multiples, where one R is the amount you risked. A trade that makes twice what you risked is a plus two R; a trade that hits your stop is a minus one R. Thinking in R instead of dollars is what later lets you read expectancy, the average R you would expect to win or lose per trade across a large sample. Without a fixed risk, the same idea can look brilliant or broken depending only on how big you bet.

Worked example: fixing risk at 1% of the account

The account is $10,000 and the rule risks 1% per trade. The entry is $50.00 and the stop is $49.50.

Risk budget per trade (10,000 x 1%)$100
Risk per share (50.00 - 49.50)$0.50
Position size (100 / 0.50)200 shares
Stop hit (200 x -0.50)-$100, or -1R
Target at 1x risk ($50.50) hit (200 x 0.50)+$100, or +1R
One R on this trade$100

Illustrative numbers. Costs and slippage would shift both outcomes slightly against you.

Try it: size a trade from a fixed risk

Change the account size, the risk per trade or the stop distance and watch the position size and the dollar value of 1R change. The defaults match the worked example.

Filters narrow, failure conditions protect

A filter is a gate: only consider the trade when something is already true, like "only between the open and 11am" or "only when the day's range is above its average." Filters cut out the setups the idea was never meant for. A failure condition is different: it is the line in the sand that says the idea itself is dead, like "if it loses on twenty trades in a row in a calm market, stop trading it." Filters shape each trade; failure conditions protect you from clinging to a broken idea.

Put the steps in the order you should actually build a testable rule set.

  1. Write the entry as one exact, unambiguous condition
  2. Define both exits: where you take profit and where you take a loss
  3. Fix the risk per trade so results can be read in R
  4. Add filters that limit the idea to the conditions it was built for
  5. State the failure conditions that would make you abandon the idea
Entry
The exact condition that puts you into a trade
Exit
What takes you out, for both profit and loss
Risk per trade
How much you lose when a single trade is wrong
Filter
A condition that must be true before you consider a trade
Failure condition
The sign that the whole idea is broken and should be dropped

Here is the translation in practice. The hunch was "price bounces off the prior day's low in the first hour." Written as a rule set it becomes: Filter, only act between 9:30am and 10:30am New York time. Entry, go long on the open of the first bar that trades down to the prior day's low and then closes back above it. Exit, take profit at one times your risk, take the loss if price closes below the prior day's low. Risk, lose no more than a fixed amount per trade, sized from the distance to that stop. Failure condition, if the prior-day-low level stops holding across a large sample, treat the edge as gone. Notice that nothing in that paragraph requires a human to decide anything in the moment.

entry exit risk filters failure

What is the real job of a failure condition, separate from a normal stop loss? It defines, in advance, what would make you abandon the whole idea A failure condition retires the strategy itself when the evidence says the edge is gone. A stop loss only ends one trade.

One warning as you write rules. Every specific number you choose, the one-hour window, the one-times-risk target, the exact stop, is a parameter, an adjustable setting. Parameters are necessary, but each one is a knob you could later turn until the past looks perfect. The discipline is to choose them for a reason you can state out loud before you test, not to tune them afterward until the equity curve is pretty. A rule set with three honest parameters is far more trustworthy than one with a dozen that were all nudged to fit history. The lesson on overfitting and curve-fitting shows how quickly that goes wrong. The opposite mistake is just as common: so many filters that they never all line up at once. Each extra condition removes setups, and a rule set with five or six of them can scan years of history and take no trades at all. Zero trades is not a cautious result, it is no result. Loosen or remove a filter, then read the win rate and the rest only once there is a real sample.

You can now write an idea as a rule set

You learned the five parts: entry, exit, risk, filters, and failure conditions, and how to turn a hunch into rules a backtest can replay without judgment.

Check your understanding

Which of these is a testable entry rule?
Buy at the open of the first bar after a close above the prior day's high. It names an exact condition and an exact action, so any computer would take the same trade.
An account is $20,000, risk per trade is 0.5%, and the stop is $2 below the entry. How many shares fit the risk?
50 shares. 0.5% of $20,000 is $100 of risk. At $2 of risk per share, $100 / $2 = 50 shares.
A rule set scanned four years of data and took zero trades. What is the most likely cause?
The entry conditions and filters are so strict that they never all line up at once. Each extra filter removes setups. Stack enough of them and none are left.

Common questions

Why can't I just backtest a chart pattern I see?
A pattern you recognize by eye is not yet a rule a computer can replay. Until entry, exit, and risk are written so the same conditions trigger the same action every time, there is nothing precise to test, and your eye will quietly cherry-pick the good examples.
What is the minimum a rule set needs before testing?
At least a defined entry, a defined exit, and a risk amount per trade. Filters and failure conditions make the test more honest, but with no entry, no exit, and no risk, a backtest has nothing concrete to measure.
Are failure conditions the same as a stop loss?
Not quite. A stop loss is one exit on a single trade. A failure condition describes when the whole idea should be considered broken, for example a market regime where it stops working, so you know in advance what would make you abandon it.

Terms defined in this lesson

Continue

Sources

Written and reviewed by the Agenticks Learn editorial team. How we write and check lessons.

Agenticks Learn is general education. It is not financial, investment, tax or legal advice, it does not take your situation into account, and nothing on it is a recommendation to buy, sell or hold any security or to open any account. Examples use illustrative numbers. Investing involves risk, including losing money you put in, and past performance does not predict future results. Tax rules and limits change; the official sources linked in each lesson are the final word.