Page **1** of **1**

### Pairs trading in futures.

Posted: **June 11th, 2013, 8:44 am**

by **deskquant**

Hi, this may be a classical or a rather simple problem. I am looking to build a pairs trade using futures contracts that have monthly expiries. An obvious question is how to deal with expiration aside from the fact that I need to roll any expiring positions.My question is basically around setting up the backtest and an efficient execution. One idea could be to make sure that my out of sample period never straddles my expiration point. In other words, since I need to liquidate my positions at the end of out of sample period and also at the end of expiration, I can take care of both of these by building a strategy from expiry to expiry. I am not sure if I was clear, but please let me know if I wasn't and if yes, please offer any advice or suggestions.

### Pairs trading in futures.

Posted: **June 11th, 2013, 6:27 pm**

by **Martinghoul**

Why don't you "stitch" together a time series of continuous futures prices? Once you've done that, there should be no issues such as you describe...

### Pairs trading in futures.

Posted: **June 12th, 2013, 1:30 am**

by **deskquant**

Thanks for the note. I already do that, I guess I wasn't clear. Basically here is what I have in my mind, and please let me know if I sound totally off.Say you have 1000 points of continuous data, Say my insample is from 1 to 200 points, and out sample is from 201 to 300 points and so on. Obviously at the end of the first out sample period, my strategy changes depending on my model specifications. And I will liquidate any open positions to reflect the change in my model. Now I also have to liquidate any open positions when the contract expires. I was looking to do this at the same point in time. In other words I want my out sample end to coincide with my futures expiry time. Does that make more sense?

### Pairs trading in futures.

Posted: **June 12th, 2013, 6:07 am**

by **GuitarTrader**

hi, how to stitch together a time series of continuous futures prices?any common method

### Pairs trading in futures.

Posted: **June 12th, 2013, 7:06 am**

by **Martinghoul**

QuoteOriginally posted by: GuitarTraderhi, how to stitch together a time series of continuous futures prices?any common methodI think there's a well-known paper floating arnd on the web somewhere that talks about a few common methods for doing this... I think it's this one: Futures, but there are others.QuoteOriginally posted by: deskquantThanks for the note. I already do that, I guess I wasn't clear. Basically here is what I have in my mind, and please let me know if I sound totally off.Say you have 1000 points of continuous data, Say my insample is from 1 to 200 points, and out sample is from 201 to 300 points and so on. Obviously at the end of the first out sample period, my strategy changes depending on my model specifications. And I will liquidate any open positions to reflect the change in my model. Now I also have to liquidate any open positions when the contract expires. I was looking to do this at the same point in time. In other words I want my out sample end to coincide with my futures expiry time. Does that make more sense?No, sorry, it doesn't, but that could be because I am being slow... Given you have a continuous futures series and assuming you believe in the "continuity", why do you have to liquidate at expiry? Why not roll? I also don't understand the point you're making about the model changing at the end of the sample period...

### Pairs trading in futures.

Posted: **June 12th, 2013, 7:11 am**

by **deskquant**

Thanks again for the note. About the model change, I have sets of overlapping insample training and out of sample trading periods. I have divided my data into many such periods. I refit or re train my model at the end of every out of sample period, hence the model changes? Is that not commonly done? You can think of it as a rolling model fitting procedure.With regards to the roll, yes I need to roll but the market I am in does not have calendars so rolling is actually selling the expiring contract and buying the new front month. The whole point is that I want to make sure that my rolling point coincides with my out of sample end point, so that I pay the cost ( of rolling ) only once. Once my out of sample expires, I essentially need to liquidate my portfolio because the behavior ( the model parameters ) has changed. If this coincides with expiry, then I can basically start afresh at the next insample fitting period - outsample trading period. Does that make more sense now?

### Pairs trading in futures.

Posted: **June 12th, 2013, 6:09 pm**

by **tagoma**

Quotehi, how to stick together a time series of continuous futures prices?I would say this is an art more than a science. Besides Marthinghoul's suggestion, one can also find some hints in 8.1.4.2 Rolling nearby futures contracts (RiskMetrics), and in Carol Alexander's Market Risk Analysis (I don't remember which volume).(Message in a bottle) I am curious to read papers or anything else about pair trading of ags futures.

### Pairs trading in futures.

Posted: **July 22nd, 2013, 3:08 pm**

by **chocolatemoney**

My 2 cents, I haven't been dealing with this prob for a while, but if I remember correctly:CSI's UA user guide gave me some good hints on what can be done (frwd vs backwards adjustments, roll triggers, etc).It may be worth a look:

http://www.csidata.com/custserv/onlineh ... Manual.pdf