Backtesting, what is it?

Wiki Definition

Backtesting is a term used in modeling to refer to testing a predictive model on historical data. Backtesting is a type of retrodiction, and a special type of cross-validation applied to previous time period(s).

We first need a strategy to backtest

Then, what is strategy?

A strategy is nothing but an idea on when to BUY and SELL?


Say, you are analysing NIFTY chart, and found that whenever NIFTY breaks previous day high, it moves higher most of the time, and you also found that after upside breakout, it rarely reverses and breaks day’s low.

Hooray! you got a BUY and SELL idea! 

Buy = Price breaks previous day high
Sell = Price breaks day low

What next?

Even though you got an idea, you won’t trade straightaway because of fear.

what is the fear?

Whether it will work or not?

Though we will never going to know what will happen in the future, but we can check what would happened in the past.

Now you are entering in to the realm of backtest.

Next thing that you will do is, download data in excel sheet for past several months and check each day for your conditions, note down entry and exit prices, calculate profit and loss.

If the results are inline with your idea and expectations, your confidence in the idea will increase which will dim the fear ‘Whether it will work or not?’, and you will
move on to next stage ‘Live Trading’

Backtest doesn’t mean using sophisticated TA software, analysing past data manually with the help of excel is also a kind of backtest. But using computer software will help you to analyze large data with different combinations in very little

There are couple of questions which needs to be answered before you enter into a trade?

  • When to Enter?
  • When to Exit?
  • Where to put stoploss?
  • How many trades to take?
  • How much capital to allocate for single trade?
  • Quantities to trade?

Here comes the use of backtest, it will give you answers for the all above questions.