BACKTESTING · DATA QUALITY

Crypto Backtesting With Missing Candles: Reject or Repair the Dataset?

Missing candles can come from no trading, exchange outages or download errors. Each needs a different fix, and some datasets should be rejected.

Short answer

Before backtesting, scan the dataset for missing candles and classify them: no-trade intervals on illiquid markets (keep as gaps or zero-volume bars with no price change only if your venue reports them that way), exchange outages (exclude the period; fills were impossible), and data errors (re-download or reject). Binance's open-interest statistics endpoint notes that periods with no trades are omitted and not backfilled, an example of gaps by design. Never forward-fill prices silently; record what you did.

Classify the gaps

Gap typeCauseAction
No tradesIlliquid marketMark as no-trade; no fills inside
OutageVenue downExclude; no fills possible
Download errorAPI or storage issueRe-download or reject dataset
Listing/delistingMarket not yet/no longer existingPoint-in-time universe
Gap handlingGap handling. Steps: 1. Scan timestamps — Expected vs actual; 2. Classify — No-trade, outage, error; 3. Fix or reject — Per type; 4. Document — Rules applied; 5. Backtest — With gaps respected1Scan timestampsExpected vs actual2ClassifyNo-trade, outage,error3Fix or rejectPer type4DocumentRules applied5BacktestWith gaps respected
Data checks come before strategy checks. Original ChartsPod editorial graphic.

Review Crypto Backtesting With Missing Candles with bar replay before using it live.

Open ChartsPod replay

When to reject

If more than a small share of bars is missing for unexplained reasons, or gaps cluster around high-volatility periods (where outages often occur), the dataset can bias results. Illustrative rule: reject if >0.5% of bars are unexplained gaps, or if any unexplained gap falls in your strategy's typical trade windows.

Illustrative gap share by source dataset (%)Illustrative gap share by source dataset (%): Exchange API A 0.02 %; Third-party CSV 1.40 %; Scraped data 3.10 %.ILLUSTRATIVE GAP SHARE BY SOURCE DATASET (%)Exchange API A0.02 %Third-party CSV1.40 %Scraped data3.10 %
Source quality varies a lot. Original ChartsPod editorial graphic.

Rules

Dataset acceptanceDataset acceptance: Gap count and share reported; Each gap classified; No silent forward-fill; Outage periods excluded from fills; Dataset version recorded.DATASET ACCEPTANCEGap count and share reportedEach gap classifiedNo silent forward-fillOutage periods excluded from fillsDataset version recorded
Write the rules before seeing strategy results. Original ChartsPod editorial graphic.

Related: Missing Crypto API Data: Null, Zero and Empty Arrays Mean Different Things, Why a DEX Token Chart Has Gaps: No Trades vs Missing Data.

Example: gaps during a crash

Illustrative: a third-party dataset is missing 40 one-minute candles during a sharp crash. A mean-reversion strategy backtested on it shows excellent buys at the lows, because the gap hides the period when prices were falling fastest and fills would have been worst. Re-downloading from the exchange restores the bars, and those 'excellent' entries turn into large losses.

Conclusion

Classify every gap, repair only what you can verify, and reject datasets with unexplained gaps in the periods that matter.

Put Crypto Backtesting With Missing Candles next to price, flow and positioning in one workspace.

Open a ChartsPod workspace

Questions readers ask

Should I forward-fill missing candles?

Not silently; it creates tradable prices that didn't exist.

How do I know if a gap is an outage?

Check venue status history and whether other markets on the venue also gapped.

When should I reject data?

When unexplained gaps exceed a small threshold or fall in key periods.

Sources and methodology

Backtesting principles follow TradingView's Pine Script documentation on strategies, repainting and non-standard charts, and ChartsPod's strategies-and-backtests guide summary, as read on 17 October 2026. All numbers are illustrative and do not describe a real strategy's performance.

  1. Binance: USD-M market data (long/short ratios, OI statistics, klines) — ratio definitions, 30-day retention, kline open/close time.
  2. TradingView Pine Script: Strategies — simulated fills and assumptions.

This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.

CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.