In "Beware the backtest" (June 2011), we discussed many issues relating to data, as well as how the markets have changed over the past few years because of electronic trading. We discussed the effects the closing of the day session had on trading when open outcry trading dominated and how the shift to electronic order matching changed the landscape. We also discussed how to deal with the gaps between contracts.
Here we will expand on those concepts and demonstrate how to formulate the proper foundation for your systems. First, let's pick up on the topic of rolling contract data — shifting from one contract month to the next — and how that can affect the results of a system backtest. Consider the following basket of markets: Copper, corn, cotton, crude oil and the euro. Now, let's look at rolling the contracts based on three different sets of criteria, discussed in detail in the June issue: Volume/open interest, volume and fixed dates.
We are going to use combined pit/electronic CSI data for our analysis. It is not easy to merge pit-only and electronic-only results based on when electronic volume surpasses pit volume. The CSI combined data reflects a 24-hour electronic market with the pit values for high and low included. If the pit values are outside the 24-hour electronic range, the pit values are used.
In addition, we also will use Pinnacle merge contracts based on the fixed dates. Again, this uses the pit contract until the electronic markets have more volume. Our merge dates are as follows: Euro: Sept. 25, 2007; crude oil: Dec. 15, 2008; cotton: July 11, 2008; corn: April 2, 2007 and copper: May 13, 2008.
We will test this data using two different systems and the same parameters for all the data sets. (Because we are looking at the differences in performance between the four data sets and not attempting to identify a successful strategy, we will not deduct for slippage and commission.)
Testing the rolls
We'll start our comparison with a simple channel breakout system. Here's the code:
Sub CHANBREAKOUTBreakdown (SLen)