From the June 01, 2011 issue of Futures Magazine • Subscribe!

How to backtest trading systems and avoid curve fitting

Understanding market data

The first and most important issue we need to address when we backtest trading systems is data. Futures contracts face an additional consideration because they are finite instruments. Backtesting on futures data over time requires contracts to be spliced together to create longer data series. This is necessary for analysis as well as for those trades that persist across the lifespan of two distinct contracts.

The process is made more complicated because of the differential that exists between two adjacent contracts. This differential is because of interest rates and other cost of carry factors that affect differences between the physical commodities and their derivative futures contracts. This gap means you can’t just splice the contract data together. One, the other or both must be adjusted to eliminate the gap.

In a gap-adjusted continuous contract, every price gap caused by a contract roll is measured and removed. This difference can be applied in one of two ways: It can start at the beginning and work its way forward, or it can start at the end and work its way backward. The second method, called back-adjusting, is most common as it leaves the active contract unadjusted so its prices reflect current reality.

For example, on the September E-mini S&P 500 contract, we closed at 1300.40 on Sept. 11, 2006, while the December contract closed at 1311.60 (see "Market shift," below). This difference of 11.60 points is the rollover gap between the two contracts. Now, this roll gap is up, as the difference is positive. If we wish to remove this gap, we need to make adjustments in all the previous prices upward by 11.60 points to effectively close the gap. If the difference were negative, then the roll gap would have been down, and adjusting all previous prices downward by 11.60 points would have closed it. An important point to note is that this process (back-adjustment of prices) is ongoing, and gets repeated each and every time a new contract is added.

image

Back-adjusted contracts have the following issues: Actual price levels can get lost and prices also can become negative; price ratios (for example, the ratio between gold and silver) can’t be calculated using pre-roll prices; volatility as a percentage of prices is distorted; stops can’t be based on a percentage and must be in points only; and pattern-matching algorithms can fail because back-adjusting can change the shape of historical price patterns.

Despite these issues, back-adjusted data still are valid. Their differences are absolute, which allows them to be converted to the dollar values per the change in the prices. Of course, you must make sure that you do not generate trade signals based on false prices.

Comments
comments powered by Disqus