Steps to Backtest your strategy.

Sourabh Sisodiya
4 min readMay 19, 2020

This is an article that covers the steps to backtest a strategy before deploying capital into the strategy.

  1. Idea/Hypothesis
  2. Specify entry,exit, SL & position size
  3. Generate trade log & Backtest Report
  4. Test in different market conditions.
  5. Optimize the strategy
  6. Evaluate the robustness & stress testing
  7. Track Real-Time performance
  8. Deploy
A detailed version of the steps

Step I -Idea(Snorlax Strategy)

As we all know that Options decay with the passage of time. So I look at the theta decay curve and wonder that some decay is intraday and some are overnight. Our Strategy aims to find out if we can capture the intraday theta decay by creating delta neutral positions?

Step II -Can we create an intraday straddle to capture theta decay?

Initial Logic of our Strategy -

Entry: Create straddle at 9:15 am

Exit: Close the straddle at 3:15 pm

SL: 10% of the combined option premium

Position Size : 1 lot (CE & PE) per 1 lakh

Step III -Generate trade log & basic backtest report

The trade log contains all trades as per your trading logic. Also, plot the equity curve and certain backtesting metrics to see if the results are decent. If yes then proceed further else discard the strategy.

Trade log and Backtest report.

Step IV -Generate a detailed backtest report & test across different market conditions.

Look for metrics such as- Outlier adjusted performance, max drawdown & time drawdown profit factor model efficiency, etc to decide whether the systems fit your psychology.

Step V-Optimize

If the basic results look good, dig deeper.

Try to give a thought on these questions.

  • What if we exit at a pre-defined profit instead of 3:15 pm?
  • What days are suitable for the strategy?
  • Days when should avoid the strategy?
  • High vix or low vix?

Step VI -Robustness & Stress Test

  • Check performance on black swan days.
  • Check performance by removing outliers and max.
  • Are trades evenly distributed?
  • Consistent performance quarter by quarter, year by year, and even check the distribution of PnL
  • Also, do walk-forward testing. (Will explain this later in future articles)

Step VII -Track Real-Time Performance

Start live execution with small quantity before actual deployment to get a feel of the strategy. Try to incorporate the feedback from live execution to further improve the strategy.

Step VIII -Deploy

If the strategy passes all the above steps then it’s fit for live deployment. Deploy the strategy and monitor real-time performance. The live performance should be similar to the backtest results

Step IX -Other important points

Make sure you avoid the following backtesting pitfalls and clean the data before backtesting.

  • look-ahead bias
  • in sample bias
  • survivorship bias

Also include slippages, brokerage for a true picture of the strategy

Step X

As a rule, if you backtest for n months, you can trade for n/3 months. And you need to assess your strategy from time to time because as market conditions keep changing your strategy may stop working.

How do you know your strategy has stopped working? Think over it.

--

--