Designing a rules-based trading system
The answer
A trading system is a written specification with 6 parts: setup, entry, filter, exit, stop, size. Every part must be stated so exactly that a stranger, or a computer, could execute it without asking you a question.
The value of writing it down is not automation. It is that a rule you cannot write cannot be tested, and a rule that cannot be tested can only be defended.
Why this costs you money
You have been trading for 3 years. Ask yourself a simple question: what is your win rate?
Most people do not know. They have an impression, and the impression is usually wrong in a specific direction — they remember the large wins and the recent losses, and they forget the long middle.
Here is what that costs. Without a written system, you cannot tell the difference between these 2 situations:
- The rule is sound and you are in a normal losing streak.
- The rule is broken and you are watching it fail.
They feel identical from inside. Without a written specification and a recorded expectation, you have no way to separate them, so you do the only thing available: you decide based on how you feel this week. That means you abandon sound rules during ordinary drawdowns, and you persist with broken ones during lucky runs. Both errors are expensive and both are guaranteed by the absence of a document.
There is a second cost, and it is larger. An unwritten rule silently changes. You start with "I buy breakouts above the 50-day high." Two losses later you are buying breakouts above the 50-day high when the market feels strong. Three months later you are buying whatever looks like it is going up. You never decided to change anything. There was nothing to change, because there was nothing written.
How it works
Here are the 6 components. A system missing any of them is not a system.
1. Setup — what is eligible. Which universe of instruments this applies to at all. Which market. What minimum average daily traded value, so you can actually get in and out. Any exclusions: no companies under a certain size, nothing in the first 6 months after listing, nothing under a trading restriction. The setup is the filter you apply before you look at anything.
2. Entry — the exact trigger and the exact execution. The condition that makes you buy, stated with numbers. Then: at what price, with what order type, at what time of day. "Buy on a breakout" is not an entry. "Buy with a limit order at the open of the next session, if today's close is above the highest close of the last 50 sessions" is an entry.
3. Filter — what stops you from taking a valid signal. This is the component people leave out and it is often the one that matters most. A filter is a condition that must also be true. Common ones: only take long signals when the index is above its own long-term average; do not enter within 2 days of a scheduled results announcement; no more than 2 open positions in the same sector.
4. Exit — how a winning position ends. A target, a trailing rule, a time limit, or a condition that says the reason for the trade has gone. Most people specify the entry in great detail and leave the exit to judgement, which means the entry is being tested and the exit is not.
5. Stop — how a losing position ends. Where it sits when you enter, whether it moves, and what happens if the price opens past it. That last part is not a detail. On a bad day the stop does not execute at your level, and a system that has not stated what to do in that case has a hole exactly where the largest losses live.
6. Size — how much. Expressed as a rule, not a feeling. The most common professional form is: risk a fixed small percentage of capital on each position, and let the distance to the stop determine the number of shares. A position with a wide stop is smaller. A position with a tight stop is larger. This is the component that determines whether you survive, and it is the one retail traders spend the least time on.
Now the design principle that governs all 6.
Every number in your system is a parameter, and every parameter is a chance to fit the past.
Count them. "The highest close of the last 50 sessions" is 1 parameter. "Exit after 20 days" is another. "Only when the index is above its 200-day average" is a third. A system with 3 parameters is testable. A system with 12 is a description of history.
Fewer parameters are more robust for a reason you can feel: with 12 dials, you can make almost any set of past prices look profitable, so a profitable result tells you almost nothing. With 2 dials, you cannot, so a profitable result means something.
A useful discipline: each parameter should be justified by a mechanism you can say out loud, not by a test result. "50 days because that is roughly a quarter, and quarterly reporting drives repricing" is a justification. "50 days because 50 tested better than 45" is a fitted number, and article 6 in this cluster explains why that is worse than useless.
Discretionary against mechanical. This is a real trade-off, not a moral question.
| Mechanical | Discretionary | |
|---|---|---|
| Can be tested | Yes | No |
| Adapts to new conditions | Poorly | Sometimes well |
| Fails in a way you can diagnose | Yes | Rarely |
| Depends on your state of mind | No | Completely |
| Can be improved deliberately | Yes | Only through experience |
Skilled discretionary traders exist and some are excellent. But a discretionary approach cannot be tested, which means it cannot be improved except slowly and expensively, and it cannot be distinguished from luck for many years. If you are going to be discretionary, be discretionary about a written system rather than instead of one.
What it tells you, and what it does not
A written system tells you what you are doing. That is more valuable than it sounds and it is genuinely rare.
It tells you what a normal losing streak looks like, so you can tell one from a failure.
It does not tell you the rules are good. Writing a bad rule precisely produces a precisely bad rule. The specification is what makes testing possible; it is not the test.
It does not make you follow it. Every serious study of mechanical trading finds that the gap between the system's results and the trader's results is caused by the trader overriding the system, almost always after a loss.
And it does not remove judgement. Judgement moved. It now lives in the design decisions, made calmly, in advance, instead of in the execution decisions, made under pressure, during a drawdown. That is the entire benefit and it is enough.
The decision rule
A rule is finished when you can hand it to somebody who has never traded, and they can execute it for a week without contacting you.
Until then it is a preference.
Before any money is committed, the document must state 5 things: what makes a trade eligible; what triggers it; what ends it in profit; what ends it in loss; and how large it is.
And 1 more, which almost nobody writes: what would make me stop trading this system entirely. State the loss, or the period without a new high, that ends it. Write it before you start, because you will not be able to write it honestly later.
Try this now
Take the sheet you started in article 3, where you wrote your entry rule. If you have not done that, do it now — it takes 2 minutes. Then complete the other 5 components.
- Setup. Write the eligible universe in 1 sentence, with a minimum daily traded value. Example shape: "Companies in the [index], with an average daily traded value above [amount], excluding anything listed less than 1 year."
- Filter. Write 1 condition that must also be true. If you cannot think of one, write "none" — that is an honest answer and it is also a parameter you have chosen.
- Exit. Write the exact condition that closes a winning position.
- Stop. Write where the stop sits at entry, whether it moves, and what you do if the price opens past it.
- Size. Write the rule that determines how many shares. If your honest answer is "about a fifth of my capital, more if I like it", write that down too. It is a real rule and now you can see it.
- Now count every number in the document. Every threshold, every period, every percentage. Write the total at the top of the sheet.
- Finally, read the whole thing back and circle every word that requires judgement: strong, clean, confirmed, holding, looks, seems.
What you should see. Two things, and both are the point.
Your parameter count from step 6 is probably between 4 and 10. Anything above 6 means you will need substantially more data to test it honestly, and article 6 explains why.
And you will almost certainly have circled words in step 7 — usually in the exit and the stop, rarely in the entry. That asymmetry is the finding. Most traders have a precise entry and a vague exit, which means the part they have thought hardest about is the part that matters least. The entry decides whether you are in. The exit and the size decide what you make.
Keep this document. It is the input to every remaining article in this cluster.
Three real cases
1. The Turtle rules, 1983 to 1984 (United States) — a complete written system, handed to beginners Two commodity traders settled a disagreement about whether trading could be taught by recruiting people with no market background and giving them a fully specified rule set. The rules covered the entire 6 components: which markets were eligible, a breakout entry with a stated lookback, a filter on recent trades, a trailing exit, a volatility-based stop, and a position size derived from volatility so that each position risked a similar amount. Several participants went on to long careers. Reported outcomes within the group varied a great deal, and the variation is attributed to how closely each person followed the rules rather than to differences in the rules themselves. The rules were later published openly, which is the second lesson: a real edge is usually not destroyed by publication, because most people cannot follow it.
2. The factor zoo, documented 2016 (United States) — what happens when everybody adds parameters Researchers surveyed the academic literature and counted several hundred published factors claimed to predict share returns. They argued that given how many had been tested, the usual statistical threshold for calling a result significant was far too weak, and proposed a substantially higher bar. The lesson transfers directly to system design. Every extra condition you add is another search, and the published academic literature has the same problem as your spreadsheet, at a larger scale and with better mathematics.
3. SEBI's studies of individual derivatives traders (India) — what unwritten systems produce at scale India's regulator has published studies examining the profit and loss of individual traders in the equity derivatives segment. The published findings report that a large majority lost money over the periods studied, with substantial aggregate losses. This is not a backtest. It is the recorded outcome of millions of real accounts. Very few of those accounts were operating a written specification with a stated size rule and a stated stopping condition, and that is the closest thing available to a controlled experiment on the value of writing it down.
The question that resolves it
A novice asks: what are my rules?
An expert asks: where is the document, and when did I last change it?
The first question can be answered from memory, and memory rewrites itself after every trade. The second requires a file with a date on it. The difference between a trader who improves over 10 years and one who does not is very often just that file.
What would make this wrong
If written systems were unnecessary, then experienced discretionary traders would show more stable results than mechanical ones over long periods. Where comparable data exists, the opposite is generally reported. If you find good evidence the other way, this article is too confident.
The honest limits are 3.
First, writing it down does not make it profitable. A precisely written bad system loses money precisely. Most of the value here is diagnostic, not generative.
Second, some genuine skill does not reduce to rules. Reading a company's management, judging whether an industry is changing, sensing when a market's character has shifted — these resist specification and they are real. Discretionary investors who work this way are not deluded. But they should be honest that they cannot test their approach and must therefore be much more conservative about size.
Third, an over-specified system is brittle. A rule with 15 conditions will stop working when 1 of them becomes irrelevant, and you will not know which. The target is not maximum precision. It is enough precision to be executable and few enough parameters to be testable.
In India
The Indian market shapes system design in 4 concrete ways.
Instrument choice is constrained. Not every listed company has liquid derivatives; the futures and options universe is a defined list that the exchange revises periodically. For a mechanical system, that list is effectively your universe if you need to short, because short selling in the cash market is restricted to intraday for most participants. A long-short system designed for American conditions may simply not be executable in India, and that is a design constraint, not a detail.
Circuit limits must appear in your rules. Your stop component has to state what happens when a stock is locked at its lower circuit and cannot be sold. A system that does not answer this has not planned for its worst day.
Costs are structured differently. Securities transaction tax, exchange fees, stamp duty, GST on brokerage and the treatment of intraday against delivery all change the arithmetic. A high-frequency rule that looks profitable before costs frequently is not after them. Put the full cost into the specification, not into a footnote.
Lot sizes force a minimum position. In derivatives you cannot buy a fraction of a contract. For a small account this means your size component may be unimplementable — the smallest legal position may already be too large a share of your capital. That is a fact about the market, and the correct response is to change the instrument, not to accept the risk.
In the United States
American conditions allow more freedom in system design and therefore more ways to go wrong.
The universe is enormous and mostly shortable. Thousands of listed companies, plus a very large exchange-traded fund market covering sectors, countries, commodities, bonds and volatility. Long-short designs are executable for retail participants, subject to borrow availability and margin rules. Fractional shares make position sizing precise. You can risk exactly 0.75% of capital rather than rounding to the nearest whole share, which means the size component of your specification can actually be followed for a small account.
Broker interfaces allow full automation. Retail participants can connect software directly to a broker and execute a written system without touching it. This is a genuine advantage for anybody who has trouble following their own rules, and it is also how a small error becomes a fast large loss.
Pattern day trading rules apply. Accounts below a stated equity threshold face restrictions on the number of same-day round trips in a rolling period. For a short-term system this is a hard design constraint that many Indian readers of American material have never heard of.
Where they differ, and what that tells you
The United States removes constraints. India imposes them.
What that tells you is where the design effort should go in each market.
In the United States, almost anything you can specify, you can execute. So the binding constraint is your own discipline about complexity, and the characteristic American failure is an elaborate system with 14 parameters, automated perfectly, fitted to history.
In India, the market itself removes options — shorting, universe, lot size, circuit limits — so the specification is forced to be simpler. The characteristic Indian failure is different: a system designed by copying American material that cannot actually be executed here, discovered only after real money is in it.
There is a practical instruction that follows. An Indian reader should write the execution constraints into the specification first, before the entry rule. Universe, liquidity, lot size, shorting, circuit behaviour and costs. If the strategy survives those, the entry rule is worth designing. Most imported strategies do not survive them, and finding that out on paper costs nothing.
Carry this
- 6 components: setup, entry, filter, exit, stop, size. Missing 1 is missing a system.
- Count your parameters. Every number is a chance to fit the past.
- The stranger test: could somebody execute this for a week without calling you?
- Write the stopping condition before you start, because you cannot write it honestly during a drawdown.