Backtesting
Backtesting means running a strategy's rules over historical prices and recording what the account would have done. The output is an equity curve, a list of trades and a handful of summary numbers such as annual return, maximum drawdown and Sharpe ratio. It is a simulation. Nothing was traded, and every order in it is a modelled order.
The value of a backtest is that it is fast and cheap evidence. A rule that sounds sensible can be checked against years of data in seconds, and a rule that loses money in every year of history can be discarded before it touches a real account. The limit is that history is one path. A backtest says what a rule would have done on that path. It does not say what the rule will do on the next one.
On DeployQuant a multi-year backtest on minute-resolution consolidated US equity data finishes in seconds, and every decision is logged with the prices and indicator values the strategy saw at that moment. The library behind these glossary pages runs 12 strategy templates on 59 ETFs over one window, 2021-01-04 to 2026-10-02, which is 5.74 years, with $10,000 of starting capital and no fees or slippage in the headline runs. The rest of this entry uses that data to show what a backtest measures, how it goes wrong, and how to read one.
What a backtest actually computes
A backtest has three parts: data, rules and an execution model. The data is the price history. The rules say when to buy and sell. The execution model decides at what price and when each order fills. Most disagreements between backtests of the same idea come from the third part, because the rules are usually stated clearly and the fills are not.
The library's method is stated in the facts for every page. Rules make daily decisions, and the engine evaluates them on minute data, so orders fill on minute bars. There is no margin. The headline run charges no fees or slippage, and separate cost runs add 5 and 10 basis points, which is how a reader sees the drag from trading costs. Prices in trade lists are adjusted for splits and dividends, so they sit lower than the quotes printed at the time. Buy-and-hold in the comparison puts 98% of the account in at the first open, the same way the templates do.
The summary numbers come from the equity curve. Compound annual growth rate, CAGR, turns the total gain into a yearly rate. Maximum drawdown is the largest peak-to-trough fall. Sharpe ratio divides return by volatility. Round trips count completed buy-and-sell pairs, and win rate is the share of them that made money. Each describes a different part of the same path, and none predicts the next path.
Buy-and-hold is the baseline every other backtest is compared with. Over the window, holding SPY from the first open ended at $21,820.48 from $10,000, a 14.56% CAGR, with a maximum drawdown of 23.99% and a Sharpe of 0.95. A strategy is only interesting if it improves on that for some reason that holds up, such as a lower drawdown at a similar return.
A backtest is evidence, not proof
The definition in the glossary says a backtest is always in-sample to the history it used. Whatever the rules were, they were written by someone who had already seen at least part of that history, and any tuning was done against it. The backtest result is therefore the strategy's best case on that data, and the honest question is how much of it would survive on data the rules never saw.
Window dependence shows this clearly. The same SPY, over the same 1,444 sessions, returned 30.46% in 2021, -18.16% in 2022, 26.18% in 2023, 24.86% in 2024, 17.72% in 2025 and 13.77% in the partial year 2026. A rule tested only on 2023 would look excellent and one tested only on 2022 would look broken. QQQ ranged from -32.39% in 2022 to 54.81% in 2023. A longer or different window changes the verdict, and one window of 5.74 years includes a single bear market.
The window also decides what kind of strategy looks good. TLT, the long-bond fund, lost 31.21% in 2022 and had a maximum drawdown of 44.06% that had not recovered by the end of the window. Its CAGR over the period was -8.64%. A trend rule that sat in cash through that decline looks wise in this window. Whether it would look wise over a window where bond prices rose is a separate test, and this backtest cannot answer it.
Sample size and what a few events can hide
A backtest result is only as informative as the number of independent events behind it. The library shows both ends of that range.
A rule that buys when the 14-day RSI falls below 30 found 18 such sessions on SPY in the window. The median SPY gain over the next 5 sessions after those signals was 3.74%, against a median of 0.42% across all sessions. Over 20 sessions the figures were 2.86% and 1.73%. That looks favourable, but 18 sessions cluster in a few selloffs, and a handful of episodes can produce a pleasing average by chance. On QQQ the same signal appeared on 15 sessions, with a 5-day median of 3.69% and a 20-day median of 1.42%, which is below the 20-day baseline of 1.74%.
The faster 2-day RSI under 10 appeared on 146 SPY sessions, with a 5-day median of 0.89% against the 0.42% baseline. More events make the average steadier, which is one reason RSI(2) snapback has a median of 166 round trips across the 59 ETFs while dip buyer has a median of 2. A median of 2 round trips means many dip-buyer backtests rest on one or two trades, and the summary statistics from them carry little weight.
On a different fund the signal behaves differently. TLT hit RSI(14) under 30 on 61 sessions, and the median 20-day return afterwards was -1.63%, worse than its baseline of -0.6%. UVXY hit it on 116 sessions with a 20-day median of -5.82%, against a baseline of -11.36%. The same rule produces opposite stories on different assets, which is why a backtest on one fund says little about the rule in general.
Lookahead, survivorship and other ways a backtest flatters itself
The related entries cover the main failure modes. Lookahead bias is a backtest using information that was not available at the decision time, such as computing today's signal with today's close and then filling at today's close. Even small lookahead can create a large fake edge, because a rule that knows the close before it trades will look very good. The defence is to have the engine enforce the order of events, so a daily rule decides on one bar and fills on a later one, rather than relying on the author's care.
The library's rules are daily-decision rules, and the facts state that orders fill on minute bars. Reading a daily close and acting on a later bar keeps the rule from trading on information it did not yet have. The fills are modelled, and a live fill can differ.
Cost assumptions are the second source of flattery. The headline runs here charge nothing, so a high-turnover rule gets credit for trades that would cost money. Round trip counts show where it matters: the weekly 7% target has a median of 106 round trips and RSI(2) snapback a median of 166, while golden cross has a median of 3. Slippage, the gap between the expected price and the fill, hits the first two many times more than the third. The 5 and 10 basis point cost runs on each strategy page exist for this reason.
Other biases sit in the data and the universe. A backtest that picks funds after seeing which ones did well carries survivorship and selection bias, and a backtest on an asset that later collapsed is not representative of live conditions. The library avoids picking winners by running every template on all 59 ETFs and reporting the median alongside the best.
Overfitting and tuning until the past looks perfect
Overfitting is tuning a strategy until it fits the noise in the history rather than a real pattern. Its symptoms are many parameters, a spectacular backtest, sharp sensitivity to small parameter changes and weak live results. Backtesting makes it easy, because every parameter change is an instant new experiment, and the best of many experiments looks good by construction.
The library's templates show how modest the typical result is when the rules are fixed in advance and run everywhere. Across the 59 ETFs, the median CAGR is 6.61% for the weekly 7% target, 5.46% for monthly cycle, 4.74% for RSI(2) snapback, 2.98% for RSI mean reversion, 1.33% for dip buyer and 0% for both momentum breakout and 3-month momentum. The number of ETFs where the template beat buy-and-hold ranges from 14 of 59 for monthly cycle to 34 of 59 for both the weekly 7% target and RSI(2) snapback. Even the two best templates beat buy-and-hold on only a modest majority of funds, and the best single result on one fund is a poor guide to the typical one.
Each strategy page includes a parameter-variants table for this reason. When a small change to a threshold or a lookback produces a very different result, the headline number is likely fitted to the window. When neighbouring settings give similar results, the rule is less fragile. A change that moves the result only a little is a better sign than a single peak.
Fewer parameters help too. A rule such as price above or below its 200-day average has one number to tune. 200-day regime filter has a median of 18 round trips, a median CAGR of 1.84% and a median maximum drawdown of 22.16%, and few places to hide an overfit.
Out-of-sample testing and paper trading
The test that matters is performance on data the rules were not built on. Out-of-sample testing holds back a later portion of history, uses a different asset, or runs the rules forward in paper trading. Out-of-sample results are the nearest a backtest gets to honest information about the future, and in-sample results are always the best case.
A simple version with this library's data is to build a rule on part of the window and judge it on the rest. The window has natural halves. 2022 was a bear year, and 2023 to 2026 were mostly rising years for SPY and QQQ. A rule tuned to avoid the 2022 decline has been fitted to the one drawdown in the sample, and the later years are the real test of whether that tuning cost it return.
Paper trading is the other out-of-sample step. The product reference describes the path as backtest, paper trade on the live data feed, then real money after a typed confirmation. Paper trading needs no broker. It checks the strategy against prices that arrive after the rules were written, and against the full order flow. How long to run it has its own answer: how long should I paper trade a strategy before going live.
Walk-forward validation extends the same idea by repeating the build-then-test split over rolling periods. The headline numbers in the library come from one run over the whole window, so they are all in-sample to it.
How to read a backtest report
A report is easier to judge in the order below, and the library's pages follow it.
First, compare with buy-and-hold over the same window. A strategy that earned less than holding the fund and took on the same drawdown has added nothing. Second, read the maximum drawdown and the date range of the worst drawdowns, because that is the loss a person would have to sit through. TQQQ's buy-and-hold drawdown over the window was 80.77%, and its calendar 2022 return was -78.1%. A report that shows a high CAGR without that drawdown leaves out the part a person would find hardest to hold through.
Third, count the trades. A result built on 2 round trips is an anecdote, and one built on 166 is a sample. Fourth, look at year-by-year returns. A strategy that earned its CAGR in one year and treaded water in the other five is a different object from one that earned steadily. Fifth, check the cost runs. If 10 basis points per trade removes most of the return, the strategy depends on frictionless fills.
Last, look at the trades themselves. Each library page lists every trade, so you can see whether a result came from one lucky entry. On DeployQuant, the decision log goes further and records the prices and indicator values the strategy saw at each decision, which makes it possible to check that the rule did what its author thought it did.
Related reading on the questions people ask most: how can you tell if a backtest is trustworthy, how many years of data should a backtest cover, how do I build my first trading algorithm and do trading bots actually work.
What the library's backtests do not cover
The numbers across these pages come from one engine, one data set and one window, and the limits are stated plainly. The window is 5.74 years from 2021-01-04 to 2026-10-02. It includes the 2022 bear market and a recovery, and it does not include a long, quiet bull market or the years before 2021. The runs use no margin. Headline runs charge no fees or slippage. Trades fill on minute bars, so the model has no view of order-book depth or partial fills.
Backtests here are hypothetical and say nothing certain about future results. Nothing on the page is investment advice. A backtest can show that a rule was consistent with a past pattern. It cannot show that the pattern will recur, and it cannot show that the rule would have been followed during the losses. Live trading involves risk of loss, including the money invested.
Frequently asked questions
What is backtesting in simple terms?
Backtesting runs a strategy's rules over historical prices to see what the account would have done. The result is an equity curve, a trade list and summary numbers such as CAGR and maximum drawdown. It is a simulation, so no real orders were placed.
Does a good backtest mean a strategy will make money?
No. A backtest is in-sample to the history it used, so it shows the best case on that data. In the library, the two best templates beat buy-and-hold on 34 of 59 ETFs, the weakest on 14 of 59, and all of it is hypothetical.
How long should a backtest window be?
Long enough to include different market conditions. This library's window is 5.74 years and holds one bear market, 2022, when SPY returned -18.16%. A window that skipped 2022 would have shown a very different picture.
What is the difference between backtesting and paper trading?
A backtest replays old prices, and paper trading runs the rules on live prices without real money. Paper trading is out-of-sample to the rules, because the prices arrive after they were written. On DeployQuant it needs no broker.
Why do backtests often look better than live results?
The common causes are lookahead bias, ignored costs, overfitting to the window and too few trades. The headline runs here charge no fees or slippage, and the 5 and 10 basis point cost runs show how much trading costs can matter. Strategies with many round trips are affected most.
How many trades does a backtest need?
There is no fixed number, but a result built on 2 round trips carries little information. The median across the 59 ETFs is 2 round trips for dip buyer and 166 for RSI(2) snapback. More independent trades make the summary numbers steadier.
Can I backtest on DeployQuant without coding?
Yes. A strategy can be built in plain English, from blocks or in Python, and a multi-year minute backtest finishes in seconds. Every decision is logged with the prices and indicator values the strategy saw.
Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.
Related terms
Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.