Skip to content

17:30 IST · Reading

Why Trading Algorithms Need Clean Historical Data

A backtest is only as good as the data behind it. If the data has mistakes, the backtest can show profits that never existed, and you may only find out when you trade with real money.

What is historical data?

It is the record of past prices. For algo trading, this is often in small time blocks, such as 1-minute candles with open, high, low, close and volume.

What does “dirty” data look like?

  • Missing candles: minutes with no data
  • Wrong prices: a sudden spike or drop that never happened
  • Unadjusted splits and bonus issues: a stock looks like it crashed 50% when it only split
  • Duplicate or out-of-order timestamps: the same minute twice, or the wrong order
  • Expired contracts: options and futures that no longer trade, with gaps between expiries

Why it matters

Your strategy follows rules. If the rules see a fake spike, they can trigger a fake trade. The backtest will count that trade, but you cannot make that trade in real life.

A quick data check before you trust a backtest

  1. Look at gaps. Are there missing days or minutes?
  2. Look at jumps. Check any huge one-day move for a split or bonus.
  3. Check the period. Does it include calm and volatile times?
  4. Include costs. Add brokerage, taxes and slippage, or profits will look bigger than they are.
  5. Do not over-tune. If you change rules again and again until the past looks perfect, you are fitting the past, not finding a pattern.
  6. Test forward. Run the strategy on paper with live prices.

How Cirrus helps

  • Same engine as live trading: Cirrus backtests run through the same engine that runs live strategies, on 1-minute history.
  • Long history: Test over up to 1,098 days, about 3 years.
  • Costs included: You can include Indian charges and a slippage setting in each backtest. A backtest lets you set the starting capital as well.
  • Every trade is visible: After a backtest finishes, you can read every simulated trade, so you can spot odd ones.
  • Paper trading: Run the same version on up to 4 paper accounts with live prices. This is a second check that does not depend on history.

Cirrus connects to 15 brokers, including Zerodha, Upstox, Groww, Dhan, Fyers, Angel One, Kotak Neo, Motilal Oswal, Alice Blue and Pocketful.

Quick takeaway

Bad data creates fake profits. Check your data, include costs, read every simulated trade, and confirm on paper before you go live.

At a Glance

Features

Dirty Data

Clean Data

Candles

Missing or duplicated

Complete and in order

Prices

Spikes and unadjusted splits

Adjusted and checked

Backtest result

Looks too good

Closer to real life

Costs

Ignored

Brokerage, taxes and slippage included

Risk

Losses show up only in live trading

Fewer surprises

Frequently Asked Questions

1. What is clean historical data? It is price data with no gaps, no wrong prices and no uncorrected splits or bonus issues.

2. Why do missing candles matter? A missing candle can hide a move or trigger a rule at the wrong time.

3. What is slippage? It is the gap between the price you expect and the price you actually get.

4. Can I see every trade in a Cirrus backtest? Yes. You can read every simulated trade after the backtest ends.

5. How long a period can I test? Up to 1,098 days, about 3 years.

6. Is a good backtest enough? No. Run the strategy on paper with live prices before going live.

7. How many backtests can I run? At most 3 can be queued or running at one time, and 50 can be run in a day.

Disclaimer: This blog is for education only and is not investment advice. Backtest results do not guarantee future returns. Cirrus is a technology platform and does not give investment advice.

Sources: cirrus.trade, Cirrus API docs (Automated strategies, Backtests)

Published More from the blog