Backtesting – speeding up the research
The process of developing a trading strategy (I mean the trading logic, not the application) is an infinite loop:
- Suggest a hypothesis.
- Code it.
- Run a test.
- If the result is not satisfactory, tweak the parameters and repeat.
- If nothing helps, look for an alternative hypothesis.
The question is: what kind of application shall we use for testing in step 3?
Of course, we could use our existing trading app, draft some strategy logic, and then run it in test mode, as we’ve just done, collecting orders and analyzing the equity time series. But then a single test may take days, weeks, and even months if we want to test the strategy under different market conditions. Do you think it’s a bit too long? I agree. That’s why, for research and development purposes, we use backtesting.
We discussed backtesting in Chapter 2, Using Python for Trading Strategies, in the Paper trading, and backtesting...