Backtesting

How to Audit Data Gaps in a cTrader Backtest

A cTrader backtest can finish cleanly while its price history is incomplete. Audit timestamps, coverage and gap-sensitive trades before trusting it.

A cTrader backtest data-gap audit checks whether the tested history is continuous where trading should have been possible. A completed report is not proof of complete data: inspect timestamp spacing, the first available bar, and every suspicious interval before trusting the curve.

Missing history does not always crash a test. It can quietly remove a signal, skip a stop path or give an indicator less warm-up data than its specification assumes. The result may still look precise. Precision is not the same as coverage.

Start with the data source and tested boundary

The audit begins by recording exactly what cTrader was asked to replay. The official cBot backtesting guide documents server tick data, server M1 bars, local M1 CSV data and server H1 bars as historical-data choices. Those inputs do not have interchangeable resolution or provenance.

Record the symbol, broker, data source, timeframe, requested start and end, and the actual first and last timestamps delivered. The cTrader Bars API reference exposes Count, OpenTimes and GetServerFirstBarOpenTime(). That gives a cBot or audit tool enough information to state what history exists rather than assume it.

This distinction also matters when the same cTrader backtest changes across brokers. Two runs with matching dates can still consume different histories.

Detect missing bars without labelling every closure a defect

A missing-bar scan compares each bar's open time with the next one. If the interval is larger than the declared timeframe, the scanner records the start, end and missing-slot count. It should not immediately call the interval bad data.

Markets close. Symbols have trading sessions. Holidays and broker maintenance can create legitimate pauses. The correct second step is to compare each flagged interval with the symbol's expected session calendar and the broker history being tested.

A useful exception report separates three cases:

FindingWhat it meansAudit action
Expected closureNo tradable session was scheduledKeep it, with the calendar rule recorded
Missing history inside a sessionOne or more expected observations are absentRepair the source or exclude the run
Unresolved intervalThe calendar or source cannot explain the pauseTreat the result as unverified

Do not forward-fill an OHLC bar. Copying the previous close invents a path with no observed high, low or volume. If a source is incomplete, the honest fixes are to obtain the missing history, narrow the test window or reject the run.

Coverage checks must include indicator warm-up

A test can start on the requested date and still begin too early for its own indicators. A moving calculation, volatility estimate or higher-timeframe filter needs prior observations before its first decision is valid.

Measure warm-up explicitly. Log when each indicator first becomes ready, then prevent trading until every required series has enough valid history. If the strategy reads another symbol or timeframe, audit that secondary series too; a clean chart for the primary symbol says nothing about auxiliary data.

The cTrader Bars reference documents LoadMoreHistory() and reports how many bars were added to the beginning of the collection. Loading more history can solve insufficient depth. It cannot prove that the loaded interval is gap-free, so rerun the timestamp scan after loading.

Measure whether each gap could change the strategy

Not every missing observation changes a result. The audit should still test sensitivity rather than declare a gap harmless from its duration alone.

For each unresolved interval, inspect whether the strategy had an open position, a pending order, a scheduled decision or an indicator window crossing it. Then rerun on a repaired source where possible. Compare signals, fills, trade count, equity path and drawdown timing, not only final net profit.

A gap near a stop or breakout threshold can change event order. A gap during a quiet flat period may change nothing. The strategy, not the visual size of the blank, determines materiality.

This is the same discipline used when comparing bar-close and intrabar backtesting: the question is whether the available path can support the execution claim being made.

Keep a compact data-quality manifest

A reproducible backtest should travel with a data-quality manifest. It does not need to be elaborate, but it must make silent assumptions visible.

Include:

  • broker, symbol and historical-data mode;
  • requested and actual coverage boundaries;
  • bar count and declared timeframe;
  • expected session calendar and timezone convention;
  • every flagged interval and its classification;
  • warm-up rule for every required series;
  • source repair, exclusion or unresolved limitation;
  • a checksum or version identifier for any local CSV file.

The manifest does not make imperfect data perfect. It makes the imperfection reviewable. realbacktesting is a trading-software studio for cTrader built around results traders can reproduce; its proof standard is useful only when the underlying history can also be identified and checked.

What this audit cannot prove

Continuity does not prove correctness. A dataset may contain every expected timestamp and still carry bad prices, wrong volume, a timezone shift or broker-specific quotes that do not match live execution.

A gap audit is therefore one layer of validation. Pair it with broker comparisons, cost modelling and execution stress tests. It can disqualify incomplete evidence; it cannot certify that every surviving observation represents the future market.

Frequently asked

Does a successful cTrader backtest prove there are no missing bars?

No. Successful completion proves that the engine produced a report from the supplied history. Verify the actual boundaries and scan adjacent timestamps to establish coverage.

Should missing bars be filled with the previous close?

No. Forward-filling invents an OHLC path and can suppress volatility or alter signal timing. Repair the history from a defensible source, narrow the test or mark the run unverified.

Are weekend gaps data errors?

Not automatically. A long timestamp interval can be an expected market closure. Classify it against the symbol's trading sessions before deciding whether data is missing.

Do I need to audit secondary symbols and timeframes?

Yes. Any series used by the strategy can change its decisions. Audit its coverage and warm-up independently from the primary chart.

The stubborn takeaway

If you cannot account for the holes in the history, you cannot account for the trades that history produced.

Published Sep 18, 2026 · realbacktesting · Educational content and market commentary — not financial advice. Trading involves risk; past performance does not guarantee future results.