Learn · Trading & Charts · Regimes, Systems and Statistics
Building a Rule-Based System
A system is five decisions made in advance — what to trade, when to enter, when to exit, when to stand aside, and how much to risk — written so precisely that a computer could follow them. Writing them before testing is what makes a test mean anything: a rule adjusted after seeing the data has already been fitted to it.
The five decisions every system makes
Every trading method answers five questions, whether or not its user has written them down. A system is simply a method whose answers are written down in advance. The **universe** is what the rule may trade: which markets, which stocks, filtered how — liquidity above a threshold, price above $5, a sector, an index. The **entry** is the exact condition that opens a position. The **exit** is really three exits: the stop that says the idea is wrong, the target or trailing rule that takes profit, and often a time stop that closes a trade going nowhere. The **filter** is the condition under which the rule stands aside entirely — a trend rule that only trades when the index is above its 200-day average, for example. And the **size** is how much is risked per trade, which is where the risk lessons enter the system. Two further assumptions belong in the specification because they decide whether the backtest resembles reality: how the trade is executed (at the next open, at the close, with a limit) and what it costs (spread, commission, slippage). A rule that “buys at the close of the signal day” cannot be traded exactly, because the close is only known once it has happened. • Universe — what may be traded, and the liquidity floor. • Entry — the exact opening condition. • Exit — stop (wrong), profit rule (right), time stop (going nowhere). • Filter — when to stand aside. • Size — risk per trade, from the stop distance. • Plus: execution timing and costs, stated, not assumed away.
Precise enough for a computer
The test for whether a rule is written down is blunt: could a computer follow it without asking a question? “Buy strength” fails. “Buy at the next open when the close is the highest close of the past 20 sessions” passes. “Exit when the trade stops working” fails. “Exit at the next open after a close below the lowest low of the past 10 sessions, or if the price falls two average true ranges below entry” passes. Precision is not pedantry. A rule with judgment inside it cannot be tested, because every result can be explained after the fact — a losing trade “wasn’t a real pullback” — and it cannot be improved, because there is no fixed thing to change one piece of. Precision also protects the trader from themselves: the most expensive parameter in most systems is the unwritten one, “unless I feel otherwise”, which tends to activate after losses and before the best trades. The worked example turns the vague method from the prediction into a rule. Every adjective has been replaced by a measurement. From a method to a rule — “Strong stocks”: Top 20% of the S&P 500 by 6-month return, price above the 200-day average · “When they pull back”: Close at least 5% below the 20-day high · Entry: Buy at the next open · “Get out when it stops working”: Stop 2 × ATR(20) below entry; exit on a close below the 50-day average · Size: Risk 1% of equity per trade: shares = 1% ÷ stop distance · Costs: Spread + $0 commission + 0.05% slippage each way ←
Three archetypes, and what each one is betting on
Most systems are variations on three ideas, and knowing which one a rule belongs to tells you in advance which market will hurt it. A **trend rule** bets that moves persist: own the market while it is above a long average, or while its return over the past year is positive. It is wrong often, cuts losses quickly and lets a few large winners pay for everything — which is why its win rate is low and its losing streaks long. It is hurt by choppy, range-bound markets. A **breakout rule** is a trend rule with a sharper trigger. The best-known example is the system Richard Dennis and William Eckhardt taught their “Turtle” trainees in 1983: enter on a 20-day (or 55-day) breakout, exit on a 10-day (or 20-day) breakout the other way, stop at two “N” — N being the 20-day average true range — and size each unit so that a 1N move costs 1% of equity. A **mean-reversion rule** bets the opposite: that short-term stretches snap back, buying a sharp pullback inside an uptrend and selling the bounce. It wins often, makes small gains, and is hurt by exactly the persistent moves a trend rule lives on — including crashes. None of the three is better in general. They are bets on different market behaviour, and their returns tend to be uncorrelated with each other, which is why professional trend and mean-reversion systems are often run side by side. Three archetypes — Trend (200-day filter): Bets on persistence · low win rate, large winners · hurt by chop · Breakout (Turtle 20/10, 2N stop): Bets on persistence after a break · hurt by false breakouts · Mean reversion (buy sharp pullbacks): Bets on snap-backs · high win rate, small gains · hurt by persistent moves ←
Specify before you test
The order of operations is the whole discipline. Write the rule — every parameter chosen for a reason you can state — and only then look at how it would have done. The moment you change a parameter because of what the test showed, the test has become part of the design, and its result no longer says how the rule will do on data it has not seen. Three habits keep a specification honest. Use few parameters: every extra threshold is another dimension along which the rule can be fitted to noise. Choose round, reasoned values — a 200-day average because it approximates a year of sessions, not 187 because 187 tested best. And write the specification on one page before testing, with the reasoning for each choice beside it. T22’s capstone calls that page the system card; it is the document a test is run against. Finally, decide in advance what result would make you abandon the rule. A rule with no failure condition is a belief, and a belief cannot be tested. • Write the rule first; test second; never the other way round. • Few parameters, each with a stated reason. • Round, reasoned values — not the ones that tested best. • One page, before the test, with the reasoning beside each rule. • A stated result that would make you abandon it. A discretionary override is a parameter. If the rule says buy and you sometimes do not, the system you are running is the rule plus your mood — and your mood was never tested.
The Turtles: a complete system, written down
The best-known demonstration that trading rules can be taught comes from 1983, when the futures traders Richard Dennis and William Eckhardt recruited a group of novices — the “Turtles” — and gave them a fully written system. Entries were breakouts: buy when a market made a new 20-day high (or a 55-day high in the longer system), sell short on the matching low. Size was set in units of volatility: the average true range, called N, decided how many contracts made a one-N move cost about 1% of the account. Stops sat two N from the entry, positions could be added to in steps as a trend extended, and exits came on a shorter opposite breakout. What made it a system rather than a style is that every one of the five decisions on this lesson’s first page was answered in advance and in numbers: what to trade (a diversified list of liquid futures), when to enter, how much, when to get out with a loss, and when to get out with a profit. Nothing required judgment in the moment, which is also why the hardest part, by the participants’ later accounts, was following the rules through long losing stretches, when the system looked broken and was simply waiting for a trend. The lesson is not that breakouts are magic; trend rules have had long dry spells since, and the edge has varied. It is that a complete specification — entry, size, stop, exit, universe — is what makes a method testable, teachable and survivable, and that most of the difficulty lies in executing it, not in designing it. • Entries: 20-day or 55-day breakouts. • Size: units set by the average true range (N) so a one-N move costs about 1% of equity. • Stops two N away; additions as a trend extends; exits on a shorter opposite breakout. • The hard part was following the rules through losing streaks. The five decisions, as the Turtles answered them — What to trade: A diversified list of liquid futures · When to enter: A new 20-day or 55-day high or low · How much: Volatility units: a one-N move ≈ 1% of equity ← · When to exit: A stop two N away, or a shorter opposite breakout
Forward-test before money
A backtest tells you how rules would have behaved on data you have already seen. A forward test tells you how they behave on data that did not exist when you wrote them, executed by you rather than by a spreadsheet. The step between the two is where most systems fail, so it deserves a plan of its own: run the rules on paper — in this app’s paper account — for a fixed period or number of signals, recording every signal, the fill you would have got and the fill the backtest assumed. Three gaps usually appear. Fills are worse than the backtest assumed, especially at breakouts, where everyone wants the same side at the same moment (M17). Signals arrive at inconvenient times, and some are skipped — which turns a tested system into an untested one. And the trader’s own behaviour changes after a losing run, adjusting rules that should not be adjusted (P12). Each gap can be measured in a paper journal (P16) before any money depends on it. Write the kill criteria before the forward test begins: the drawdown, the number of trades and the gap from the backtest that would end the experiment. Then start live trading at a deliberately small size, scale up only as the live record matches the forward test, and keep the journal running — a system is only as good as the version of it you actually execute. • Paper-trade the exact rules for a fixed number of signals. • Measure three gaps: fills, skipped signals and your own rule changes. • Write kill criteria before the test starts. • Go live small; scale only as the live record matches. Backtest, forward test, live — Backtest: Rules on data already seen — the optimistic case · Forward test on paper: Real signals, your execution, no money at risk ← · Live at small size: Scale only as the record matches the forward test
What you'll practise
Which of these is a testable entry rule?
40 XP in the app · multi select
Sources
- The original Turtle trading rulesFaith, “Way of the Turtle” (2007); the published Turtle rules of Dennis and Eckhardt
- Trend-following rules and their evidenceHurst, Ooi & Pedersen, “A Century of Evidence on Trend-Following Investing” (2017)
- System design and position sizingVan Tharp, “Trade Your Way to Financial Freedom”
- Evidence-based technical analysisAronson, “Evidence-Based Technical Analysis” (2007)
Learn content is for education only — not individualized financial advice, a recommendation, or a solicitation to buy or sell any security. Options involve substantial risk. Examples are simplified and historical patterns never guarantee future results.