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 type | Cause | Action |
|---|---|---|
| No trades | Illiquid market | Mark as no-trade; no fills inside |
| Outage | Venue down | Exclude; no fills possible |
| Download error | API or storage issue | Re-download or reject dataset |
| Listing/delisting | Market not yet/no longer existing | Point-in-time universe |
Review Crypto Backtesting With Missing Candles with bar replay before using it live.
Open ChartsPod replayWhen 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.
Rules
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 workspaceQuestions 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.
- Binance: USD-M market data (long/short ratios, OI statistics, klines) — ratio definitions, 30-day retention, kline open/close time.
- 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.