Skip to main content
CRYPTO RESEARCH / EDUCATIONNO LIVE PRICES · NO TRADING SIGNALS
Menu
CRYPTO / METHOD EXPLAINED

Why a moving-average backtest must not trade on tomorrow's information

Work through previous-close trading signals, next-open simulated fills and costs with a transparent historical data example.

ORIGINAL MATHEMATICAL EXAMPLE · EDUCATIONAL · NOT A LIVE MARKET QUOTE

What look-ahead bias means

A historical strategy can appear impressive when a simulator accidentally lets it trade at a price that was not known until later. For example, computing a moving-average crossover from a day's closing price and then pretending the trade occurred at the beginning of that same day uses future information. The apparent success cannot be reproduced in real time using that rule.

One reproducible signal

Consider a simple moving average (SMA) over two recent closes and another over three recent closes. At the end of day 3, the observed closes are 10, 11 and 12 USD. The fast average is (11 + 12) / 2 = 11.5; the slow average is (10 + 11 + 12) / 3 = 11. If a strategy first permits purchases when the fast average exceeds the slow one, the earliest hypothetical execution based on those observations is day 4's opening price, not day 3's opening price.

What the scenario engine models

The CoinMetriq SMA teaching tool holds either cash or a long position. It uses prior-close data to decide each next-open buy or sale, applies the stated percentage fee to each simulated transaction, and revalues the position at that day's closing price. A companion buy-and-hold comparison uses the same initial cash and a simplified fee-inclusive entry. Both are hypothetical, deterministic and fully based on your imported historical OHLCV rows.

What it cannot infer

The tool does not simulate spread, live order-book liquidity, market impact, funding, tax, chain latency or exchange downtime. Selecting SMA lengths after seeing the historical results can itself overfit the sample. A larger or more sophisticated backtest is not proof that the strategy will work in unseen market conditions, and none of the results are a trade recommendation.

Quick questions

Why does the example strategy trade at the next open?

The strategy learns the completed moving averages only at the prior close, so using that day's earlier opening price would introduce future knowledge.

Do simulated transaction costs reflect live execution?

No. The model uses a manual percentage fee and excludes slippage, order-book depth, outages and latency.

Try the exact calculation

Open the corresponding free browser tool, enter the numbers from this explanation and verify the output. The example is fictional and has no predictive meaning.

Primary and original reference sources

Published: 2026-11-23 · General education; the scenarios described are not investment or tax advice. Verify changing technical and legal claims against the current primary sources.