Missing Data
Missing data is any absent value in a series — from trading halts, holidays, illiquidity, feed outages or corrupt records — and the danger is not the gap itself but the fill: replacing a missing value carelessly, especially by carrying a future value backwards, injects information a real trader never had and biases the backtest.
Quick Answer
Missing data comes from halts, holidays, illiquidity and feed faults, and the danger is the fill, not the gap itself. Forward-filling is safe because it uses only past prices; back-filling or interpolating leaks future information. Mark circuit-locked days untradeable rather than inventing a fill, and never let a NaN become zero, which a backtest reads as a total crash.
Definition: Missing Data
Missing Data is any absent value in a market-data series — arising from halts, holidays, illiquidity or feed faults — whose real risk lies not in the gap but in how carelessly it is filled.
Key takeaways: Missing Data
- Missing data comes from holidays, halts, illiquidity and faults, and each needs different handling
- Forward-filling is generally safe; back-filling and interpolation leak future information
- Halted or circuit-locked days should be marked untradeable, not filled with invented prices
- A NaN coerced to zero is read as a total crash, so NaN policy must be explicit
- Dropping non-random missing rows is a quiet form of survivorship bias
Missing Data at a glance
| Causes | Halts, holidays, illiquidity, feed faults |
|---|---|
| Forward-fill | Safe — uses only past data |
| Back-fill / interpolation | Look-ahead — uses post-gap data |
| Halts / circuits | Mark untradeable; do not fill a price |
| NaN coerced to zero | Read as a 100% crash |
| Dropping rows | Survivorship-like bias if missingness is non-random |
Missing Data in simple words
Missing data is the holes in a price history: days the market was shut, a stock that did not trade, a feed that dropped out, or a cell that reads NaN. Every backtest has to decide what to do with these holes, and that decision matters more than it looks. Fill them the wrong way and you either invent prices that never existed or, worse, quietly leak future information into the past.
What Missing Data is for
Handling missing data exists because no real dataset is complete, and the method you use to patch the holes is itself a modelling assumption that can add or remove bias without you noticing.
Missing Data — professional explanation
Why data goes missing
Gaps arise for very different reasons, and the reason dictates the correct treatment. Exchange holidays and weekends are expected absences that a calendar should handle, not a fill. A trading halt or a lower-circuit day means the instrument genuinely could not be traded, so a filled price would misrepresent a period when no exit was possible. Illiquid instruments simply do not print on some days. And feed outages or corrupt records are true data faults where the value existed but was lost. Conflating these — treating a halt like a holiday, or an outage like an illiquid day — produces subtly wrong backtests.
The forward-fill versus back-fill distinction
The single most important rule is directional. Forward-filling — carrying the last known value forward until a new one arrives — is generally safe because it only ever uses information already available at that time. Back-filling — carrying a future value backwards to patch an earlier gap — is dangerous because it inserts a price that was not yet known, a direct form of look-ahead. Interpolating between a past and a future point is a subtler version of the same sin, because the interpolated value depends on data from after the gap. As a default, a backtest should forward-fill or leave gaps explicit, never back-fill prices used for decisions.
Halts and untradeable periods
When an instrument is halted or locked at a circuit limit, the honest model is not to fill a plausible price but to record that no trade was possible. A backtest that fills a halted day with an interpolated price may show an exit or entry that could never have executed, understating the risk of being trapped in a position. This is especially relevant for Indian small and mid caps that hit upper or lower circuits, where a strategy might in reality be unable to sell for several days while the backtest happily books an exit at a made-up price.
NaNs and how they propagate
Explicit missing markers such as NaN are actually safer than silent gaps because they are visible, but they must be handled deliberately before indicators are computed. A single NaN feeding into a moving average or a standard-deviation window can poison the whole window, producing a NaN signal or, if the library silently drops it, a statistic computed over the wrong sample. Worse is a NaN that gets coerced to zero, which a price series reads as a 100 percent crash and a return series reads as a total loss. Every pipeline needs an explicit, logged policy for NaNs rather than relying on a library default.
How the fill choice biases results
Each fill method leaves a fingerprint. Forward-filling a stale price flattens volatility and can suppress or delay signals, making a mean-reversion system look calmer than reality. Interpolation smooths the series and understates true gaps and drawdowns. Filling untradeable halts creates fills that inflate performance by pretending liquidity existed. Even dropping missing rows biases results if the missingness is not random — illiquid or stressed names go missing precisely when they matter most, so deleting them is a quiet cousin of survivorship bias. The correct method is the one whose assumption matches why the data is missing, and it should be stated, not defaulted.
Worked example: Missing Data
Illustrative example (Indian market)
You backtest a portfolio that includes an NSE mid-cap stock which hits its lower circuit for three straight days, printing no tradeable volume, on capital of Rs 5,00,000. Your data has gaps on those three days. If you interpolate a smooth path between the pre-halt price of Rs 480 and the post-halt price of Rs 410, your backtest shows an orderly decline and books an exit at, say, Rs 445 on day two. In reality the stock was locked and you could not have sold at any price until it reopened at Rs 410. The interpolated fill understated your loss by Rs 35 a share and invented liquidity that did not exist. Recording the halt as untradeable, and marking the exit at the real reopening price of Rs 410, produces the honest and far worse outcome.
Indian small and mid caps regularly hit upper or lower circuits, and index constituents observe NSE trading holidays that differ from global calendars. A backtest that treats a circuit-locked day as a normal filled bar, or that misaligns Indian holidays with foreign data in a multi-market test, will book fills that were impossible and generate signals on days the market was shut.
Forward-fill vs Back-fill
| Aspect | Forward-fill | Back-fill |
|---|---|---|
| Direction | Carries last known value forward | Carries a future value backward |
| Look-ahead risk | None — uses only past data | High — inserts future information |
| Effect on series | May flatten volatility if stale | Can invent knowledge of the future |
| Safe for decisions? | Generally yes | No |
| Typical use | Default gap handling | Avoid for anything traded on |
Limitations of Missing Data
- The correct fill depends on why data is missing, and that reason is often not recorded in the feed
- Forward-filling stale prices flattens volatility and can hide real risk
- Any back-fill or interpolation across a gap introduces look-ahead by using post-gap information
- Dropping missing rows biases results when missingness is non-random, as with stressed or illiquid names
- Circuit halts mean no trade was possible, which most fill methods silently ignore
How professionals treat Missing Data
Serious researchers first classify why a value is missing — holiday, halt, illiquidity or fault — and treat each differently, using a trading calendar for expected absences and marking halts as untradeable rather than filling them. For decision data they forward-fill or leave gaps explicit and never back-fill, and they log every fill so the pipeline is reproducible. They also test sensitivity to the fill choice, because a strategy whose result changes materially with the missing-data policy is resting on an artefact rather than an edge.
Common mistakes with Missing Data
- Back-filling or interpolating prices that are then used to make trading decisions
- Filling a halted or circuit-locked day with a plausible price and booking a fill that could not have happened
- Letting a NaN be coerced to zero, which reads as a total crash in a price or return series
- Deleting rows with missing values when the missingness is correlated with stress or illiquidity
- Using a library default fill without knowing or logging which method it applied
- Aligning multiple markets without reconciling different holiday calendars, creating false gaps or signals
Missing Data: frequently asked questions
What is missing data in a price series?
Missing data is any absent value — from exchange holidays, trading halts, illiquidity, feed outages or corrupt records. It shows up as gaps in the series or as explicit markers like NaN, and every backtest must decide how to handle it.
Why is missing data a problem for backtesting?
Because the way you patch the gaps is itself an assumption. Fill them carelessly and you either invent prices that never traded or leak future information into the past, both of which bias the backtest without any obvious warning.
What is the difference between forward-fill and back-fill?
Forward-fill carries the last known value forward and uses only information available at the time, so it is generally safe. Back-fill carries a future value backwards to patch an earlier gap, which inserts information the trader did not yet have and causes look-ahead.
What happens if a NaN becomes zero in price data?
A price of zero reads as a total collapse, and a return computed from it reads as a 100 percent loss, so a single coerced NaN can create a catastrophic phantom move. NaN handling must be explicit and logged, never left to a silent default.
Is it okay to delete rows with missing data?
Only if the missingness is random. Illiquid or stressed instruments tend to go missing exactly when they matter most, so deleting those rows quietly removes the worst outcomes, which is a cousin of survivorship bias.
What is the safest default for missing decision data?
Forward-fill or leave the gap explicit and skip the decision. Both use only information available at the time, whereas any method that reaches across the gap to a future value risks look-ahead.
Voice search: how people ask about Missing Data
Natural-language questions people ask about Missing Data.
What is missing data in a backtest?
It is the holes in your price history — days the market was shut, a stock that did not trade, or a value that got lost. How you fill those holes can quietly bias your results.
What is the safest way to fill a gap in prices?
Carry the last known price forward. That only uses what you already knew at the time. Never fill a gap using a price from later, because that leaks the future into the past.
Why is filling a halted day a problem?
Because during a halt you could not trade at all. If your backtest fills a nice price and books an exit, it is pretending you could sell when you actually could not.
Sources & references
- NSE — Trading Holidays calendar.
- NSE — Circuit Filters / Price Bands (daily price bands and market-wide circuit breakers).
Published 11 July 2026. Educational content only — not investment advice. Markets and rules change; verify current conventions with SEBI, NSE/BSE and your broker.