VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Backtesting and validation

What is backtesting (回測)? Meaning, steps and limits for futures

回測 (backtesting) runs fixed trading rules over historical prices to see how they would have traded. For futures, use clean data, realistic costs, the right session and next-bar execution, then check the result on data the strategy never saw.

By · Published · updated · Editorial policy

Contents
  1. What does 回測 (backtesting) mean?
  2. How do you backtest a futures strategy, step by step?
  3. Which numbers in a backtest report matter most?
  4. Why can a good backtest still fail in live trading?
  5. What should you check after a backtest looks good?
  6. Frequently asked questions
  7. References

What does 回測 (backtesting) mean?

回測 (backtesting) means running a fixed set of trading rules over historical price data to see how they would have traded. For futures, a useful backtest uses clean continuous data, realistic costs, the right trading session and next-bar execution. Its results describe the past only. Trust them more after the strategy also holds up on data it never saw.

The Chinese word is literal. 回 means "back" and 測 means "test", so 回測 is a test run backwards in time. A backtest is a simulation that applies fixed trading rules to past prices, bar by bar, and records every trade the rules would have made. At the end it reports the trades, the equity curve and summary numbers such as net profit and drawdown.

A backtest works like a flight simulator that replays the weather from real past flights. It shows how your rules handle conditions that already happened. It does not show tomorrow's weather. It is still very useful, because a rule that fails on past data rarely deserves real money, and the simulator costs nothing when it crashes.

How do you backtest a futures strategy, step by step?

A futures backtest is only as realistic as five settings: the data, the rules, the costs, the session and the execution timing. Set all five before the first run, in this order.

  1. Prepare the data. Futures contracts expire, so a test over several years needs a continuous series that joins one contract month to the next. Check how the rolls were handled, whether the timestamps use the exchange's time zone, and whether there are gaps or bad ticks. Choose a bar size that fits the strategy. If a stop and a target can both be hit inside one long bar, that bar does not tell you which came first.
  2. Write the rules completely. Every entry, exit, stop and position size must be a rule a computer can follow with no judgment. "Buy when the trend looks strong" is not a rule. "Buy when the close is above the 50-bar moving average" is.
  3. Add trading costs. Include commission, exchange fees, tax where it applies, and slippage. Slippage is the difference between the price the backtest assumed and the price you would really get. Model costs per round trip (entry plus exit). The guide to trading costs in backtests: commission, slippage and the average trade shows how to estimate them.
  4. Set the trading session. Decide which hours the strategy trades and which bars it may use. Day-only bars and full-session bars give different results on the same contract.
  5. Use next-bar execution. Next-bar execution means the backtest acts on a signal at the following bar, not at the close of the bar that produced the signal. A rule that decides on a bar's close cannot also fill at that same close in real trading.
Five settings of a futures backtest (data, rules, costs, session and next-bar fill) all feed into one backtest report, so each one changes the result Five inputs shape the report Every arrow feeds one result 1 Data 2 Rules 3 Costs 4 Session 5 Next-bar fill Report Each setting changes the report. So: set all five before you run.
The five settings of a futures backtest. Each one changes the report, so set all of them before the first run.

Sessions matter more in futures than many traders expect. On TAIEX futures (台指期, code TX), the regular session runs from 08:45 to 13:45 Taiwan time, and the after-hours session runs from 15:00 to 05:00 the next day. Exchanges can change session hours, contract values and fees, so confirm them on the exchange's contract page before you test. The free futures market hours tool shows trading hours by exchange and session in your own time zone.

AlphaPrime (Valynox) includes fees, slippage, trading sessions and next-bar execution in its backtesting, so every strategy it evaluates is measured with the same realistic settings.

Which numbers in a backtest report matter most?

Net profit is the least informative number on its own; trade count, average trade and maximum drawdown tell you far more. Read them together.

OutputWhat it tells youWhat to look for
Number of tradesHow much evidence the result rests onFew trades can be luck. A few dozen is a weak sample; a few hundred says more.
Average trade (after costs)The edge per tradeIt should be several times the round-trip cost, so a small rise in slippage does not erase it.
Maximum drawdownThe deepest loss from a peakAsk whether you could keep trading through it, in money and in nerves.
Drawdown durationHow long equity stayed below its last peakLong flat periods are hard to sit through live.
Yearly resultsWhether the result depends on one periodOne great year and several flat ones is fragile.
Long vs. short resultsWhether one side carries everythingKnow which side earns the result and why.

Maximum drawdown is the largest drop in the equity curve from a peak to a later low. The free drawdown calculator computes maximum drawdown and recovery from any equity series, including one exported from a backtest.

The average trade comes from one simple formula:

Average trade = net profit ÷ number of trades

Here "net profit" is the total result after all costs. "Number of trades" counts each completed round trip once. The result is what one trade earned or lost on average, in points or money.

Hypothetical example

A rule set on TAIEX futures day-session bars is tested over five years. The report shows 250 trades and a net result of 2,500 index points after an assumed cost of 3 points per round trip. Average trade: 2,500 ÷ 250 = 10 points. Maximum drawdown: 700 points.

Stress test: raise the assumed cost from 3 to 5 points. The net result falls by 2 × 250 = 500 points, to 2,000 points, and the average trade falls to 8 points. The edge survives the higher cost.

A second rule set shows 40 trades and an average trade of 4 points. One extra point of slippage removes a quarter of its edge, and 40 trades are too few to separate skill from luck. The first report is worth testing further; the second is not.

Why can a good backtest still fail in live trading?

The most common reason is overfitting: the rules were tuned to the past so closely that they learned noise instead of a repeatable pattern. Overfitting is when rules or parameters fit the random wiggles of historical data that will not happen the same way again.

Think of a student who memorizes last year's exam answers. The score on last year's exam is perfect. The score on this year's exam shows what the student really learned. A backtest tuned on the same data it reports is the memorized exam.

Overfitting grows with the number of variants you try. Test enough combinations of rules and parameters and one will look excellent by chance alone. Research on this effect shows that the best in-sample result from many trials often performs poorly on new data (Bailey et al., 2014). It also shows that reported backtest results should be discounted for the number of tests behind them (Harvey & Liu, 2015).

Other causes are more practical, and each one leaves a sign you can check:

Sign to checkWhy it matters
A very smooth equity curve with many parametersMany settings give the search more ways to fit noise.
Results change sharply when a parameter moves one stepA real edge rarely sits on a single exact value.
Small average trade, many tradesReal slippage can be larger than the assumed cost.
Fills at the same bar's close that gave the signalThis uses a price you could not have traded at.
Big jumps in equity at contract rollsThe continuous data may contain roll errors.
Most profit from one short periodThat market condition may not return.
Hypothetical equity curve of an overfitted strategy: it rises smoothly on the in-sample data used to choose the rules, then stays flat with small ups and downs on out-of-sample data it never saw The fit stops on new data Hypothetical equity curve In-sample Out-of-sample The tuned fit did not carry over. So: judge it on unseen data.
Hypothetical illustration: an overfitted strategy looks smooth on the data used to build it and loses its edge on data it never saw.

What should you check after a backtest looks good?

Test the strategy on data it never saw, and test the way you built it, before you trust the result. In-sample data is the data used to choose the rules and parameters. Out-of-sample data is data that played no part in those choices.

  1. Hold out data. Keep the most recent part of the history aside, for example the last 20 to 30 percent. Build on the rest, then run the finished rules once on the held-out part without changes.
  2. Run a walk-forward analysis. Walk-forward analysis is a repeated cycle of optimizing on one window of data and testing on the next window, then moving forward. It shows whether your re-tuning process holds up across many periods, not one. The guide to walk-forward analysis: why one backtest is not enough covers window lengths and how to read the results.
  3. Stress the costs. Rerun with double the slippage. A strategy that fails here depended on cheap execution.
  4. Check the neighbours. Move each parameter one or two steps. Results that stay similar point to a broad edge; results that collapse point to a lucky value.
  5. Read the yearly results. Look for profit spread across years and market conditions, not packed into one.

A strategy that passes these checks has stronger evidence behind it. It is still evidence about the past, so size the first live trading small and compare live fills with the backtest's assumptions. AlphaPrime's strategy validation offers Basic, Standard and Extensive validation, including walk-forward analysis, with thresholds you set yourself.

What this means if you use AlphaPrime: set data, costs, sessions and next-bar execution once in the research settings, and every candidate is measured the same way. Then send the strategies that look good through validation before you treat any backtest as a reason to trade.

Frequently asked questions

What does 回測 mean in trading?

回測 is the Chinese term for backtesting. It means running a fixed set of trading rules over historical price data and recording every trade they would have made. The result shows how the rules would have behaved in the past, after costs if you include them.

How reliable is a backtest?

A backtest is reliable as a measurement of the past when the data, costs, session and execution timing are realistic. It is not a forecast. Its value for live trading depends on whether the strategy also holds up on out-of-sample data and in a walk-forward analysis.

How many trades does a backtest need?

There is no fixed number, but more trades give more evidence. A few dozen trades can easily be luck, while a few hundred trades across different market conditions say much more. Strategies with many parameters need more trades, because they have more ways to fit noise.

What is the difference between backtesting and paper trading?

Backtesting runs rules over past data in seconds or minutes and covers years of history. Paper trading runs rules forward in real time without real money, so it is slow but uses prices the strategy has never seen. Many traders backtest first, validate on out-of-sample data, then paper trade or trade small to compare real fills with the backtest.

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.

What AlphaPrime does here

AlphaPrime's backtesting evaluates strategies with fees, slippage, trading sessions and next-bar execution, and its strategy validation adds walk-forward analysis and your own thresholds before a strategy goes further.

See plans and pricing