Techniques for back testing

Dear friends,

I have been following tradingqna since long. And learned many things from all the traders friends here.

Need to learn and discuss various back testing techniques either through any system/softwares or manually used by traders in today’s world. It would be great if @Abid_Hassan @nithin and @Karthik also can contribute to this topic.


Backtesting is an integral part of building a trading strategy. It essentially gives you insights into your trading logic and helps you understand how the strategy has behaved in the past.

Assume you have a super simple strategy - Buy when 9 days EMA crosses over 21 days EMA and sell when the opposite happens. Once you define your strategy, you will have to select a look back period. Look back period could be 6 months, a year, 2, or 5…or 5+ years.

After you select the look-back period, you will essentially have to identify how many times in the past has the 9 EMA has crossed 21 days EMA. Or in other words, figure out how many times in the past your strategy has worked. You can either do this manually or do this programmatically.

The results you need to note are -

  1. How many signals were generated (buy and sell)
  2. Average holding period per signal
  3. Overall profitability after adjusting for transaction costs
  4. How many of the buys were successful and how many sells were successful
  5. What was the average profit % per win
  6. What was the average loss per loss
  7. How many consecutive winning streak
  8. How many consecutive losing streak

The above-mentioned points give your various insights - the list can get exhaustive, but what I’ve mentioned here are few essential metrics.

Good luck!


Sounds very useful. Thanks a ton

1 Like