VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Quant stories

Ernest Chan's Quantitative Trading: lessons for backtesting

Ernest Chan's Quantitative Trading tells independent traders to start with simple, explainable strategies, test them honestly and cost them realistically. For a futures trader, the lessons translate into a short list of backtest settings and checks.

By · Published · updated · Editorial policy

Contents
  1. What is Ernest Chan's Quantitative Trading about?
  2. Why does Chan favour simple strategies?
  3. Mean reversion or momentum: which should you test?
  4. How does look-ahead bias creep into a backtest?
  5. What is data-snooping bias and how do you limit it?
  6. How do costs and capacity change a strategy?
  7. How can a retail futures trader apply the book?
  8. Frequently asked questions
  9. References

Ernest Chan's Quantitative Trading teaches that an independent trader should start with simple, explainable strategies, test them honestly and include realistic costs. Its core backtesting lessons are to avoid look-ahead bias, to limit data snooping by keeping parameters few, to include every trading cost, and to check that the strategy still works at the size you plan to trade.

Quantitative trading is trading where every entry, exit and position size comes from rules that a computer can test on historical data. Chan's advice sits at the small end of a range whose far end is Jim Simons and Renaissance: similar statistical habits, very different resources.

What is Ernest Chan's Quantitative Trading about?

The book is a practical guide for people who want to run a small, one-person trading business. It is not a mathematics textbook. Its subtitle is How to Build Your Own Algorithmic Trading Business. Wiley published the first edition in 2008 and later released a second edition.

The book follows the path a trader actually takes:

  1. Find strategy ideas in public sources such as papers, books and trading blogs.
  2. Backtest them and recognize the common ways a backtest lies.
  3. Set up the account, the data and the execution system.
  4. Size positions and manage risk, including a chapter on the Kelly formula.
  5. Learn special topics such as mean reversion, momentum, regime changes and stationarity.

The examples use code and spreadsheets: MATLAB and Excel in the first edition, with Python and R added in the second. You can apply the lessons without copying any code. They are habits for testing, and any backtesting tool can follow them.

Why does Chan favour simple strategies?

A simple strategy with few parameters has fewer ways to fit the past by accident, so its backtest says more about the future. A parameter is any number in a rule that you can change, such as a lookback length, a stop distance or an entry threshold. In the strategy generation of AlphaPrime (Valynox), a lookback length, stop distance or entry threshold becomes a parameter range you cap in advance, which keeps the number of free parameters in view.

Think of a key. A key with three teeth opens many similar locks. A key with thirty precisely cut teeth opens exactly one lock. A strategy with many tuned parameters is the thirty-tooth key: it fits the history it was cut for and little else.

Chan also asks for a reason. A strategy should have an explanation for why it might work, for example forced selling that pushes prices too far or slow reaction to news. Three practical checks follow from this:

  • Count the parameters before you run anything. Each extra one should earn its place.
  • Write the reason in one sentence before you test. If you cannot, you are testing a pattern, not an idea.
  • Test neighbouring values. If a lookback of 20 works but 18 and 22 fail, the result is probably noise.

Mean reversion or momentum: which should you test?

Mean reversion and momentum are opposite bets on the same price, so you test which one a market and timeframe support, and you expect very different trade profiles. Mean reversion is the tendency of a price or spread to return toward an average after it moves away. Momentum is the tendency of a price that has moved in one direction to keep moving that way for a while. The momentum indicator measures it as the change in price over a fixed number of bars.

Chan treats these as the two main families of trading strategies. A key point is that one market can behave both ways. It may revert on short intraday bars and trend over weeks, and the behaviour can change when the market regime changes. Each family also has a known profile:

Mean reversionMomentum
Typical trade profileMany small winners, occasional large loserMany small losers, a few large winners
Main riskThe move does not revert and keeps goingLong flat or losing periods in ranging markets
What to check in the backtestThe largest single loss and how stops handle itThe longest period without a new equity high
Two hypothetical histograms of trade results: mean reversion shows a tall cluster of small wins with a thin tail of large losses, momentum shows a cluster of small losses with a thin tail of large wins, so each needs a different risk check Same total, opposite shapes Hypothetical trade results Mean reversion Momentum Loss Win Loss Win Similar totals, opposite risks. So: check each tail differently.
Hypothetical trade distributions: mean reversion and momentum can have similar totals but opposite shapes, so they need different risk checks.

Our guide to mean reversion strategies in futures backtests gives a testable example of the first family.

How does look-ahead bias creep into a backtest?

Look-ahead bias makes a backtest show trades that were impossible to take, and the fix is to decide only on closed bars and fill on the next bar. Look-ahead bias is the use of information in a backtest that was not yet known when the trade decision was made.

Chan lists this among the most common backtest errors. In futures research it usually looks like one of these:

  • A rule that buys during the day when the price is near the day's low, but uses the low of the full day to decide. You only know the day's low after the close.
  • A signal computed on a bar's close and filled at that same close.
  • A threshold, such as an average volatility level, computed over the whole data set and then applied to earlier dates.

A simple test catches most cases. Rerun the backtest on data that ends one bar earlier. Every signal up to that point should stay the same. If old signals change, the rule is reading the future. The article on look-ahead bias and the one-bar check walks through this test.

What is data-snooping bias and how do you limit it?

Data-snooping bias grows with every variant you try, so judge a strategy by how it does on data you did not use to pick it. Data-snooping bias is the inflation of a backtest result that comes from trying many rules or settings on the same data and keeping the best one.

An everyday comparison: ask a hundred people to flip a coin ten times each. A few will get eight or more heads by chance. Their coins are not special. A strategy picked as the best of hundreds of variants is often that lucky coin.

Hypothetical example

A trader tests 500 variants of a breakout rule on 2015–2022 data. The best variant averages $30 per trade after costs. On 2023–2025 data, which played no part in picking it, the same variant averages $3 per trade. Most of the $30 came from selection, not from an edge.

Hypothetical example: the best of 500 breakout variants averages 30 dollars per trade in-sample on 2015 to 2022 data, but only 3 dollars per trade out-of-sample on 2023 to 2025 data The best of 500 shrinks Average trade, hypothetical example In-sample 2015–2022 $30 Out-of-sample 2023–2025 $3 Most of the $30 was selection. So: judge on untouched data.
Hypothetical example: the best of many variants looks strong on the data used to pick it and much weaker on new data.

Research supports this. White (2000) proposed a test that asks whether the best rule beats a benchmark once you account for all the rules tried. Sullivan, Timmermann and White (1999) applied it to a large universe of technical trading rules. Bailey and colleagues (2014) showed how quickly backtest results inflate as the number of trials grows. The Sharpe ratio is the average return divided by how much returns swing, a measure of return per unit of risk. Harvey and Liu (2015) argue that reported Sharpe ratios should be reduced to account for multiple testing. Our summary of backtest overfitting research explains these results in plain terms.

Chan's remedies are simple. Keep parameters few. Hold back a part of the data that you never touch while you develop the strategy. Paper trade before trading real money. Walk-forward analysis adds one more check: it re-tunes the strategy on past data and tests it on the data that follows, again and again across the history.

How do costs and capacity change a strategy?

Costs decide whether a backtest edge survives, and capacity decides whether it survives at your trading size. Chan stresses that a strategy with many trades can turn from profitable to unprofitable once commission and slippage are included. The basic check needs one formula:

Net result per trade = gross average trade − round-trip cost

Here, the gross average trade is the profit per trade before costs. The round-trip cost is commission, exchange fees and slippage for both the entry and the exit. Slippage is the difference between the fill your test assumed and the one the market gives you. If the net average trade is close to zero, small changes in slippage decide the result. See trading costs in backtests for how to estimate each part.

Capacity is the largest amount of money a strategy can trade before its own orders move prices enough to eat the edge. Chan points out that this is where small traders have an advantage. A strategy too small for a large fund can still be worth trading for one person. For a retail trader, capacity limits show up in thinner contracts, in quieter sessions, and when you scale up the number of contracts.

Hypothetical example

A strategy's gross average trade is 4 ticks. Commission and fees cost the equivalent of 1 tick per round trip. With 1 contract, slippage is 1 tick per side, so the net average trade is 4 − 1 − 2 = 1 tick. At 10 contracts in a quieter session, slippage rises to 2 ticks per side, and the net becomes 4 − 1 − 4 = −1 tick. The rules did not change. The size did.

AlphaPrime evaluates every candidate with fees, slippage and next-bar execution in its backtesting. Costs therefore affect the ranking from the first run, not only at the end.

How can a retail futures trader apply the book?

Turn each lesson into one backtest setting and one pass-or-fail check, and decide both before you see any results. The table below maps the book's main lessons to futures practice.

LessonWhat to set in the backtestGood signBad sign
Simple rulesFew parameters, ranges fixed in advanceNeighbouring values give similar resultsOnly one exact value works
Mean reversion vs momentumTest both families on the same data and costsThe chosen family has a clear reason for this market and timeframeResults flip between families from year to year
Look-ahead biasDecide on closed bars, fill on the next barSignals unchanged when the last bar is removedOld signals change when data is truncated
Data snoopingUntouched out-of-sample period, walk-forward analysisOut-of-sample keeps a fair share of in-sample resultsOut-of-sample is near zero or negative
CostsCommission, fees and at least one tick of slippage per sideNet average trade is several times the round-trip costEdge disappears when slippage doubles
CapacitySlippage that rises with contract size and in quiet sessionsStrategy survives higher slippage at your planned sizeStrategy works only at one contract

For futures, add three settings the book's general advice implies. Use the trading session you will actually trade, day only or full session. Handle contract rolls consistently in your continuous data. Size positions from the drawdown you can sit through. The Kelly fraction is the share of capital a formula suggests betting based on past win rate and payoff, and because it assumes those past figures hold, treat it as an upper limit, not a target.

AlphaPrime's strategy validation offers Basic, Standard and Extensive validation, walk-forward analysis and custom thresholds. It stops the later checks when a strategy fails an earlier one, so a weak candidate does not take up review time.

What this means if you use AlphaPrime: searching many strategy variants is exactly where Chan's data-snooping lesson applies, so judge candidates by walk-forward and out-of-sample results with costs included, not by the best backtest. Keep rules simple and set sessions and slippage to match how you will trade.

Frequently asked questions

What is Ernest Chan's Quantitative Trading book about?

It is a practical guide to running a small algorithmic trading business. It covers finding strategy ideas, backtesting and its pitfalls, setting up execution, and sizing positions with risk management. Later chapters cover mean reversion, momentum, regime changes and stationarity.

What other books has Ernest Chan written?

Besides Quantitative Trading, he wrote Algorithmic Trading: Winning Strategies and Their Rationale (Wiley, 2013), which goes deeper into mean-reversion and momentum strategies. He also wrote Machine Trading: Deploying Computer Algorithms to Conquer the Markets (Wiley, 2017). Machine Trading covers topics such as machine learning and risk management for traders who already run systematic strategies.

Do the book's lessons apply to futures trading?

Yes. Look-ahead bias, data snooping, trading costs and capacity affect any backtest, whatever the market. Futures add their own settings: the trading session, contract rolls in continuous data, and costs measured in ticks per contract.

Do I need to program to use Chan's ideas?

No. The book's examples use code and spreadsheets, but the lessons are testing habits. Any backtesting tool can apply them: few parameters, next-bar fills, realistic costs and an untouched out-of-sample period.

Is data-snooping bias the same as overfitting?

They are closely related. Overfitting means a strategy fits noise in the data it was built on. Data-snooping bias is the inflated result you get when you test many variants and keep the best, which is one of the main ways overfitting happens.

References

  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
  • Harvey, C. R., & Liu, Y. (2015). Backtesting. The Journal of Portfolio Management, 42(1), 13–28.
  • Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.
  • White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126.