Most advice on building a trading strategy is about where ideas come from. Ideas are the cheap part.
Anyone can produce a dozen plausible rules in an afternoon, and a backtest will happily tell you
several of them worked.
The expensive part is elimination, and it has an order to it. Each stage below can invalidate
everything after it, so running them out of sequence wastes the work. What follows is the order we
use, with the measurement behind each step, because every one of these is a way we have watched a
backtest tell us something untrue.
1. Write the abandonment condition first
A strategy that has no stated failure condition cannot fail. It can only be adjusted.
Decide in advance what you are testing, over what period, with what costs, and what result would
make you throw it away. Then keep that document and do not edit it after seeing results. Everything
in this guide is a way of meeting that document honestly; none of it helps if the target moves.
2. Your universe is wrong before a single trade is simulated
Universe construction is where most of the damage happens, and it happens silently because a broken
universe still produces a clean-looking equity curve.
Three failures we have measured, each of which survives casual inspection:
| Failure | What we found |
|---|
| Building from today's ticker list | 815 tickers vanished in nine months; 1.75% of qualifying symbol-days belong to names that no longer exist |
| Ranking on unadjusted previous-close change | On 20.0% of sessions a top ten gainers list contained a reverse split rather than a gain |
| Trusting a public screener | A well-known gainers list missed all 15 of the day's biggest movers |
The survivorship case is the one people nod at and then get wrong anyway. It is not a random 1.75%:
the names that disappeared traded at a median of $17.11 against $35.99 for the survivors, so the
missing days are concentrated in the cheaper half of the market. Details in
survivorship bias,
reverse splits in gainers lists
and
what a public screener misses.
The fix is mechanical: build the universe from the data of the day being tested, never from a
current list. If you cannot, say so as a limitation rather than treating the result as complete.
3. The prices in your file were not tradable
A bar file gives you four numbers per period and no indication of whether any of them were available
to you.
| What looks like a price | What it is |
|---|
| Last trade far from the book | 1.90% of minute rows flagged; of the residual after scaling to the spread, 68.9% were symbols that had not traded that day at all |
| A quoted price | Good for $1,155 to $5,150 · only 3.9% to 6.3% of ten-level depth sits there |
| A minute with a bar | On an ordinary watchlist, 46% of minutes contained no new information at all |
Any rule that reads a price and assumes it was actionable inherits all three. The measurements are in
the last price is not a price you can trade at,
order book depth
and
dead minutes.
4. Fills are where the fiction lives
A fill assumption is invisible in the output. Nothing in an equity curve tells you whether the trades
behind it could have happened, which is why this survives longer than any other error in the list.
The test is to take the filled trades and ask, one at a time, what would have had to be true at that
moment for the fill to occur, then check whether it was. Most backtests never ask, because the
simulator answered the question already by assuming it.
Two rules remove most of it. First, a limit order at the best price is not a fill; something has
to trade through your price, and you are behind whatever was already resting there. The reasons it
does not fill are enumerated in
why your limit order did not fill.
Second, a market order does not execute at the quote you saw: a $5,000 market buy in a $1-5 name
costs 88bp one way against 45bp for a $1,000 order, and a $25,000 order could not be filled inside
ten visible levels 28.7% of the time
(
market order vs limit order).
If your backtest fills at the touch, it is not modelling execution. It is modelling a market that
was waiting for you.
5. Cost models are wrong in both directions
Everyone knows to include costs. Fewer people check whether the cost model is right, and the error
runs both ways.
A flat percentage is wrong because commissions do not scale with size: the same $1,000 order costs
0.35bp on a commission-free broker and 24.04bp on a per-order schedule, a ratio of 68.7x. Which
broker you assume decides the answer before the rules do.
The error also runs the other way, and that direction is the dangerous one because it produces
rejections rather than acceptances. Regulatory fees change on their own schedule, sometimes to zero
for months at a time, and a model carrying a stale rate will charge trades a bill that was not
payable. An idea killed by a cost assumption is killed quietly, with no result to inspect. Both
directions are worked through in
how to model trading fees
and
what commissions actually cost.
Before comparing anything to anything, know the toll. A $5,000 market buy in a $5 to $20 stock pays
roughly 0.75% round trip against the mid before commissions
(
the toll every trade has to beat).
An idea that produces less than that is not a marginal strategy; it is not a strategy.
6. Test the exit as hard as the entry
Entries get the attention because they are where the idea lives. Exits decide the result and are
usually specified in a sentence.
The exit is also where the market is least accommodating. On a fast drop the spread widens and the
book thins at the same time, which is precisely when a stop fires
(
stop-loss vs stop-limit). Size
the position for the book you will leave through, not the one you entered through
(
how to size a day trade).
A related trap is holding periods. If your universe turns over during the session, a rule that
assumes the name stays interesting is not being tested on the same population it selected: of names
on a 30-slot list at 09:35, 57% were still there at 10:00 and 33% by the close
(
watchlist turnover).
7. One held-back period is not out-of-sample
The usual practice, fit on one period and confirm on a later one, is necessary and not sufficient.
If you have looked at the second period even once and then changed anything, it is no longer
out-of-sample; it is a slower version of fitting.
Two things help. Freeze the rules in writing before the second period is opened, including the exact
thresholds, and hold back a third period that nobody touches until the end. And distrust results that
rest on a handful of trades. A profit factor computed over single-digit trade counts swings between
extremes on the same day with the same rules, which is information about the sample and not about
the strategy.
8. What a pass actually looks like
Not a high return. A result that survives every step above while you were actively trying to break
it, and that still works when you assume the least convenient fill, the highest plausible cost, and
the universe as it existed on the day rather than today.
Most ideas do not get there. That is the normal outcome and it is not wasted effort, because the
elimination teaches you something about the market even when it teaches you nothing about the idea.
Often the useful residue is a piece of folklore that turns out to be false. The claim that
gaps always fill does not survive contact with
144,286 of them, and knowing which part of it is false is worth more than a rule built on the part
that is true.
What this guide assumes
That you already have a backtest that runs, and that your question is whether to believe it. If you
are earlier than that, the gaps between a backtest and live trading are enumerated with costs
attached in
why your backtest does not match live trading,
which is the shorter version of this argument.
None of the above will tell you whether a strategy will make money. It tells you whether the number
in front of you is measuring what you think it is measuring, which is a different question and the
only one a backtest can answer.