You’ve decided to not take the DIY (do it yourself) route and not build your own trading algorithm.
You’ve decided you don’t want to dip your toes into the shark-infested water called starting from scratch. Now you’re tasked with finding a service that has already done the hard work for you. What do you look for in that said service?
Today we will dive into the underbelly world of algo trading and open up that can of worms called backtesting. Since I have a tendency to get a little geeky, I will resist with all my superwoman powers and try to keep it “reasonable.”
Why We Back Test Our Trading Algorithm
When you create a trading algorithm from your trading rules, the first item on the agenda is backtesting to see if your ideas are indeed profitable. If they have not been profitable over time why in the world would you think they will be profitable in the future? Like DUH!
Backtesting is the process of feeding historical data to your trading strategy to see how it would have performed with the expectation the past results we be a predictor of future results.
Testing a trading algorithm over historical data is an essential part of the strategy development process. Estimating the performance of the algorithm allows the trader to refine the strategy and modify parameters before trying it with live data. Backtesting is a complicated task requiring survivorship bias-free data and special software to run the algorithms. QiT uses Amibroker to run its algorithms and our data provider is Norgate Premium Data.
Backtesting should be a simulation of how a trader would have done if he/she responded to market data according to the model, the rules of your trading idea, over time. How would a trader buy, sell, short, cover a symbol and when? Backtesting is a way of testing the signals given by a trading system in order to see whether it would have been profitable in the past.
Overfitting data (curve fitting)
The problems with backtesting are difficult to overcome but it is vital you do or you would never have faith in any trading algorithm you write, and ultimately, incorporate into your trading. One of the biggest problems is something called “overfitting.” This happens when you continually tweak and add parameters in order to increase the overall profitability. Do this to excess and you are likely to end up with a brilliant system for the period of time under scrutiny, but one that fails miserably as market conditions change
Here’s an example. You have come up with an awesome set of rules but when you backtested it revealed a large drawdown in August 2011, the month the US debt was downgraded and the market dropped like lava through snow. Your first thought is, “What can I do to avoid that disaster,” and you start gerrymandering the model with more parameters and more stringent inputs and magically that month’s drawdown disappears. Unfortunately, it changes the entire model and the whole algorithm falls apart.
That month was part of reality and no model is going to rule out black swan events nor should it.
How do you overcome overfitting? The best way is to keep your rule set simple. Go for simpler models over more complicated models. Generally, the fewer parameters that you have to tune the better.
We’re the Plan in “Plan your Trade and Trade your Plan” – TraderJanie
Take our 30-day free trial and see why we can say, “If awesome were inches, we’d be the Effiel Tower.”