Trading glossary

Backtesting

By the PatternX team · Published

Definition

Backtesting is running a trading strategy's rules over historical market data to see how they would have performed, under stated assumptions about fills and costs. It measures past behavior; it does not predict future results.

How it works

A backtest replays history one bar at a time. At each step the strategy sees only data available up to that moment and decides whether to enter or exit, and the simulator books fills using assumptions about price, slippage, fees and, for perpetual futures, funding. The result is a trade list and the statistics built from it: net profit, win rate, profit factor, maximum drawdown and more.

Why it matters

It's the cheapest way to reject a weak idea. A rule set that loses money on history under realistic costs rarely deserves real capital. The reverse doesn't hold: a good backtest is weak evidence on its own, because much of what hurts live trading never appears in a simulation. Paper trading is the usual next check.

Common mistakes

  • Overfitting: tuning parameters until they fit past noise. Testing on data the strategy was never tuned on, called out-of-sample data, is the main defense.
  • Look-ahead bias: using information that wasn't available at the time, such as a bar's final high before the bar finished.
  • Survivorship bias: testing only assets that still exist today.
  • Optimistic costs: leaving out spread, slippage, fees or funding.
  • Small samples: a handful of trades proves little.

Example

For example, a hypothetical strategy tuned on the first 70% of a dataset earns 25% there but loses 4% on the remaining 30% it never saw. That gap is a classic sign of overfitting.

How PatternX uses it

PatternX backtests replay the same pattern engine bar by bar after 120 warm-up bars, in Classic or AI mode, with costs: 0.03% slippage, 0.05% fees per side and funding of 0.01% per 8 hours. Reports compare in-sample (first 70%) with out-of-sample (last 30%) results, add a Monte Carlo analysis, and warn when there are fewer than 30 trades. Its known limitations: market context is neutral, so liquidity, spread, order-book and funding filters are effectively off; there's no higher-timeframe or historical-win-rate input; there's one position per series and fixed sizing; and the risk engine, trailing stop, break-even, approval delay and partial fills aren't modeled. Momentum Lab backtests are separate and Elite-only. Details in backtesting methodology.

Related reading