TSAI
GUIDE Β· TRADING SYSTEMS

How to Build a Trading System

By Silviu Vasilescu Β· Updated 1 August 2026 Β· 10 min read

A trading system is a set of rules complete enough that two people following it would place the same orders. That is the entire test. If any part of your method requires you to look at a chart and decide how you feel, you have an approach, not a system β€” and an approach cannot be measured, which means it cannot be improved.

This is not an argument that discretion is worthless. It is an argument that you cannot tell whether your discretion is worth anything until the mechanical part is written down and separated from it. Everything below is about getting to that written form, then finding out what it is actually worth.

1. The six decisions a system must answer

Most people who say they have no system actually have four of these six answered and two left to mood. It is almost always the last two.

  1. 1. Universe. Which stocks are you willing to trade at all? A liquidity floor, a price floor, an exchange, perhaps a sector exclusion. This is a filter you apply before you look at anything, and it is covered in the screening guide.
  2. 2. Setup. What condition has to exist before a stock is a candidate? Above its 200-day average, in a base, whatever your edge is built on. A setup is a state, not an event.
  3. 3. Trigger. What specific event puts the order in? A close above a level, a break of yesterday's high, an opening range breakout. The trigger converts a candidate into a position, and it needs a price, not a feeling.
  4. 4. Stop. At what price is your reason for the trade proven wrong? Decided before entry, always, because it is the input to the next answer.
  5. 5. Size. How many shares? This follows arithmetically from the stop and your risk per trade β€” see position sizing. It is never a round number chosen because it feels right.
  6. 6. Exit on the winning side. What takes you out when you are right? A target, a trailing stop, a time limit, a partial scale-out. This is the most commonly unanswered question in trading, and the one that does most of the damage.

Write all six on one page. If you cannot, the missing answer is the highest-value work available to you β€” higher than any new indicator.

2. Start from an edge, not an indicator

An edge is a reason the market hands you money β€” a persistent behaviour of other participants. Trend persistence is one: money chases performance, and holders of a rising stock are not under pressure to sell. Mean reversion after panic is another: forced selling overshoots because the seller's deadline has nothing to do with value. Post-earnings drift is another: information takes time to be fully priced.

Notice that none of those are indicators. Indicators are how you detect an edge, and they are interchangeable β€” you can identify a trend with a moving average, with higher highs and higher lows, or with a rate-of-change reading, and the differences are small compared with whether trend persistence is real in your market and timeframe.

Building the other way round β€” picking an indicator and hunting for settings that made money β€” is how most beginner systems are made, and it is why most stop working. If you cannot say in one sentence why someone on the other side of your trade is systematically willing to lose, you have found a pattern in the past rather than an edge in the present.

3. Expectancy: the number that matters

Expectancy is what one trade is worth to you on average, and it is the only summary statistic that answers the question you care about. Measure results in R β€” multiples of the amount you risked β€” so trades of different sizes are comparable:

expectancy = (win rate Γ— average win in R) βˆ’ (loss rate Γ— average loss in R)

A system that wins 40% of the time with an average win of 2.5R and an average loss of 1R has an expectancy of (0.40 Γ— 2.5) βˆ’ (0.60 Γ— 1) = +0.40R per trade. Take 200 such trades in a year, risking 1% of the account each time, and the arithmetic of the method is working for you β€” although the path will not be smooth, and the drawdown along the way is a separate question with its own answer.

Two things about expectancy are easy to miss. It must be computed after costs β€” commissions, spread and slippage β€” because a +0.10R edge on a short timeframe can be entirely consumed by them. And it is only meaningful over a decent sample; thirty trades tell you almost nothing, because the difference between a good and a mediocre system is smaller than the noise in thirty results.

4. Why a high win rate can lose money

Win rate is the most quoted and least useful statistic in trading, because it says nothing about the size of the results. A method that wins 90% of the time, taking 0.2R on each winner and losing 3R on each loser, has an expectancy of (0.90 Γ— 0.2) βˆ’ (0.10 Γ— 3) = βˆ’0.12R. It loses money while feeling excellent, and it feels excellent for a long time before the tenth trade arrives.

This is the exact shape of the most common self-destructive habit in trading: taking profits quickly because a small gain is pleasant, and holding losers because closing them makes the loss real. That behaviour manufactures a high win rate and a negative expectancy at the same time β€” see the psychology guide for why it is so hard to stop.

The inverse also holds and is worth internalising: a system that is wrong two times out of three can be excellent if the third outcome is large. It will simply feel awful to trade, which is why systems of that shape need to be written down and tested before they are traded β€” nobody follows a 1-in-3 method on intuition through a nine-trade losing streak.

Chart showing a rules-based trading system's entry, stop and exit marked on price.

Every trade a system takes has the same four marks on it: setup, trigger, stop and exit. If any of the four is missing from your notes, it was not a system trade.

5. Backtesting without fooling yourself

A backtest applies your written rules to historical data and reports what would have happened. Done carefully it is the cheapest information available about your method. Done carelessly it manufactures confidence, which is worse than having none.

The failures are specific and avoidable:

Also record more than the total return. The largest peak-to-trough drawdown, the longest losing streak, and the longest stretch with no new equity high are the numbers that determine whether you will still be following the rules when it matters.

6. Curve fitting, the quiet failure

Curve fitting is tuning rules until they describe the past precisely. It is quiet because it produces the best-looking backtest you will ever see, and there is no moment where it feels like a mistake. A 14-period lookback tested well; you try 13 and 15 and 12 and 16; one is better; you keep it. Repeat across five parameters and you have a system that has memorised history.

Three habits keep it in check. Prefer fewer parameters β€” every additional one multiplies the ways you can accidentally fit noise. Prefer parameters whose neighbours also work: if 20 is profitable and 18 and 22 are profitable too, you have found a broad effect, whereas if only 20 works you have found an accident. And reserve data you never look at during development, then run the finished rules on it exactly once.

The reserved-data rule is the one people break. It only works if you genuinely do not iterate after seeing the result β€” otherwise you have simply moved the fitting to a later stage.

7. From backtest to real money

A promising backtest earns a small position size, not a full one. Trade the rules live at a fraction of your intended risk and compare the live results with what the backtest said to expect. You are not checking profitability yet β€” the sample is far too small. You are checking whether your fills resemble your assumptions, whether the signals you thought were unambiguous are actually ambiguous in real time, and whether you can execute the rules at all when the position is real.

Expect live results to be somewhat worse than tested. Some of the gap is costs you did not model; some is that the historical period was, in the end, one sample of many possible futures. A method whose live results are dramatically worse usually has a look-ahead bug, and it is worth going back to look for it rather than concluding the market changed.

8. Reviewing a system you already trade

Keep a log with one row per trade: date, ticker, setup, entry, stop, size, exit, result in R, and whether you followed the rules. That last column is the important one, because it separates two completely different problems that produce identical account balances.

If your rule-following trades have positive expectancy and your total does not, the system is fine and your execution is the problem β€” a discipline question, not a research question. If your rule-following trades themselves lose money over a reasonable sample, no amount of discipline will help, and the rules need work.

Review on a schedule β€” quarterly, or every fifty trades β€” never after a bad day. Changes made in response to the most recent loss are how a tested system quietly turns back into an approach.

THE SHORT VERSION
  • A system is rules complete enough that two people would place the same orders.
  • Answer all six: universe, setup, trigger, stop, size, and the exit when you are right.
  • Build from an edge you can state in a sentence, then pick an indicator to detect it β€” not the reverse.
  • Judge by expectancy in R after costs, over a sample large enough to mean something.
  • A 90% win rate loses money if the losers are large. Win rate alone tells you nothing.
  • Backtest against look-ahead bias, survivorship bias and real costs, and record drawdown as well as return.
  • Fewer parameters, robust neighbours, and untouched reserved data are the defence against curve fitting.
  • Log whether you followed the rules. It tells you whether to fix the system or yourself.

Build one, with the code included

Trade Stocks Like A.I. takes this from outline to working method: detailed program code for building and testing systems, over 200 annotated chart analyses, and real trades with the reasoning behind every entry, stop and exit. 206 pages, from an economist with 26 years in the market, in 25 languages.

See what is inside the book

This guide is educational material about how markets and trading methods work. It is not financial advice and not a recommendation to buy or sell any security. Trading involves the risk of losing money, including more than you intended if you use leverage. Figures used in the examples are illustrations of arithmetic, not results you should expect.