Continuous Futures Contracts Methodology for Backtesting

The problem with spliced futures

No doubt, the correct datasets are the key when one does some analysis in the financial markets. For some financial instruments, the data can be found for free and ready for the upcoming process, but on the other hand, some instruments are more complicated.

Nowadays, futures contracts are widely spread and popular among practitioners. However, each delivery month is connected with a different price where the price of the underlying asset should stand at a given date in the future (the expiration date). Clearly, this complicates any possible analysis, since there are different prices for different maturities. The industry standard for backtesting futures strategies is to construct one data sequence from a stream of contracts – a continuous futures contracts data series.

If somebody wants to hold futures contracts for a longer time, one has to roll the contracts each month, but there is a problem that the prices would be different. For example, at a rolling date, the contract ending in May can be traded for 60 dollars, and the contract ending in June can be traded for 70 dollars.

Naturally, if an investor wants to extend the position, he has to sell the contract for May and buy the one for June. If the contracts are just spliced together, the backtesting of the strategy with the spliced dataset is wrong. Such a dataset would include artificial and non-existing jumps that would appear in the analysis as profits or losses. But it is essential to keep in my mind that such jumps are not possible to achieve in the real trading practice. Moreover, the resulting backtests with spliced datasets are simply wrong, because the strategy may be looking profitable when it is not or unprofitable when, in fact, it is. Such an approach is not correct and leads to wrong results. Therefore, there is a need to apply some better algorithm that would „connect“ the futures and remove the jumps.

lean hog spliced prices prices
An example of spliced futures contracts for Lean Hogs

The solution

Firstly, it is crucial to recognize front-month and back-month contracts. The front-month is a contract that has the shortest time to expiry. Usually, this contract is accompanied with the most liquidity in the futures term structure. The back-month is a contract that has the second shortest time to expiry. The usual practice for backtesting futures strategies is to use the continuous futures series based on front-month contracts, primarily when someone uses a long-time history of the futures contract.

Algorithms for creating continuous futures series and removing the jumps are dependent on two main factors. It is important to choose the date when the successive contracts are rolled and secondly, which adjustments would be made to the raw contract prices. Since there are many options for both key elements, there are many variations of continuous futures contracts series.

Moreover, there is not the one best approach; each algorithm has it is own pluses and minuses. Therefore, for some tasks, one algorithm may be better than another – if one algorithm is the best one for trading strategy backtesting, it probably would not be wise to use the same adjusted prices for economic forecasting.

Roll dates

Firstly, the futures contract could be rolled on the last trading day of the expiring contract, and such a method is named the last-trading-day roll method. On the one hand, this method allows traders to use the front-month contract for the longest time. On the other hand, there is a danger that the liquidity and the trading activity has already switched to the back-end contract prior to the roll. This could cause unwanted delivery. 

Secondly, the contract could be rolled on the first day of the contract’s delivery month. This is called the first-of-month roll method and is very popular since it is easily predictable and therefore efficiently executed. However, such an approach is not connected to the trading activity or some specific delivery rules. 

Thirdly, the contract could be rolled according to the liquidity. The liquidity-based roll method rolls the futures contract the first day when the back contract has a higher open interest than the front contract. Naturally, this method is connected with the highest liquidity, but it should be used cautiously with interest rates or agricultural futures.

Adjustments

Clearly, the simplest method is using no adjustments at all, but as we have previously mentioned, it is also the wrong one. One of the better ways is the forwards panama canal method, where the successive contracts are shifted up or down by a constant number to eliminate jumps. Since it is a forward method, the oldest contract has a “true price“, and all successive contracts are adjusted by the fixed constant. 

Similarly, one can choose the last known contract as the “true one“. Such a method is called the backwards panama canal method. The idea is that the successive contracts are adjusted up or down by a constant to eliminate jumps, working backward from the most current contract. On the one hand, the current price would be realistic and true, but historical prices have to be recalculated after each rolling date. 

Nextly, there is the backwards ratio method, where the contracts are not adjusted up or down, but they are multiplied by a fixed constant to eliminate jumps. The ratio is computed working backward from the current contract, so again the most recent contract is the “true one”. However, each rolling date requires recalculation of the whole history. 

The last adjustment method is based on a weighted average of contract prices during a pre-determined window around the roll date. The calendar weighted method allows for transitioning smoothly from the front end to the back end contract and is somewhere in the middle of the forward and backward method. The pros are that this method delivers continuous prices and does not require recalculation during each rolling date. However, roll dates that are not predictable, which is the weak spot of this method. 

Quantpedia’s usage of continuous futures contracts

In Quantpedia, we are interested in prolonging the backtesting periods from the academical research papers. The best usage of Quantpedia is to combine ideas from our Screener and build more sophisticated strategies as combined strategies are usually more profitable or with a lower risk. 

Our strategies are usually built from a position of portfolio/fund manager who manages an entrusted portfolio. He usually divides investment fund’s resources into multiple fractions and invests them into multiple revenue streams. He is primarily interested in having information about the percentual performance of individual revenue streams and his overall portfolio/strategy. Fund’s assets under management fluctuate; therefore, portfolio manager usually does not trade trading strategy based on a constant number of futures contracts. He usually trades based on a constant proportion of the underlying asset in his portfolio. 

Therefore, for our purposes, we believe that the best approach is the first-of-month roll method and backwards ratio adjustment method. Such an approach is simple and probably the best because we want to provide information about the percentual performance of the strategies. Our backtests are performed in the Quantconnect platform, which allows easy access to Quandl free continuous futures contracts data. Since those free data from Quandl are not using any adjustment at all Quantpedia futures strategies are using our own continuous futures contracts data with a methodology as mentioned above, hosted on our server. 

Why is it so important to have a correct methodology?

This analysis may look like a dry financial theory. But the chosen methodology can have a tremendous impact on the results of backtested strategies. Let’s compare the following two charts:

Lean Hogs price history - spliced, unadjusted
Lean Hogs – price history, spliced, un-adjusted
Lean Hogs – price history, adjusted, first-of-month roll method and backwards ratio adjustment

At first sight, these two graphs seem to be representing different commodities; however, in both cases, contracts are for Lean Hogs. This commodity is very often in the „contango“, and therefore, each roll is connected with a higher price. It is essential to bear in mind that only adjusted prices should be used for backtests.

Incorrect continuous futures constracts can very easily transform into incorrect backtest. For example, if we took the Skewness Effect strategy in commodities, also described in the following article: Skewness / Lottery Effect in Commodities, backtest (using Quantconnect) with correct data looks differently from the one with wrong data (free countinuous futures data from Quandl). Following chart uses correct dataset:

Skewness / Lottery Effect in Commodities - using first-of-month roll method and backwards ratio adjustment
Skewness / Lottery Effect in Commodities – using first-of-month roll method and backwards ratio adjustment

However, if we will use spliced futures, we would have to think that the strategy is unprofitable, but such a statement would be utterly wrong.

Skewness / Lottery Effect in Commodities - no adjustments
Skewness / Lottery Effect in Commodities – no adjustments

Short conclusion

To sum it up, if one builds strategies using futures contracts, the prices have to be adjusted. Additionally, each approach or algorithm has its pros and cons, and there is not the one best algorithm. For strategy backtesting, we are using the first of month roll method and the backwards ratio to obtain correct backtests. This methodology could be successfully used in the decision making of an investor since such a technique would correctly represent the performance in the form of annual return in percentual points. Obviously, the usage of the spliced dataset would probably lead to wrong decisions, since it would advise that the strategy is unprofitable when, in fact, it is profitable.

Authors:
Radovan Vojtko, Head of Research, Quantpedia
Matus Padysak, Quant Analyst, Quantpedia


Are you looking for more strategies to read about? Sign up for our newsletter or visit our Blog or Screener.

Do you want to learn more about Quantpedia Premium service? Check how Quantpedia works, our mission and Premium pricing offer.

Do you want to learn more about Quantpedia Pro service? Check its description, watch videos, review reporting capabilities and visit our pricing offer.

Are you looking for historical data or backtesting platforms? Check our list of Algo Trading Discounts.


Or follow us on:

Facebook Group, Facebook Page, Twitter, Linkedin, Medium or Youtube

Share onRefer to a friend

Subscribe for Newsletter

Be first to know, when we publish new content


    logo
    The Encyclopedia of Quantitative Trading Strategies

    Log in

    SUBSCRIBE TO NEWSLETTER AND GET:
    - bi-weekly research insights -
    - tips on new trading strategies -
    - notifications about offers & promos -
    Subscribe