tag:blogger.com,1999:blog-35364652.post116005302778126978..comments2024-04-22T13:29:20.051-04:00Comments on Quantitative Trading: An arbitrage trade between energy stocks and futuresErnie Chanhttp://www.blogger.com/profile/02747099358519893177noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-35364652.post-82294469500531085112011-01-23T07:58:56.860-05:002011-01-23T07:58:56.860-05:00Ken,
Given I know now about the tendency of regime...Ken,<br />Given I know now about the tendency of regime shift in oil futures (from contango to backwardation and back, see also my blog post http://epchan.blogspot.com/2011/01/shorting-vix-calendar-spread.html)<br />I would not have traded this spread at all.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-54276364373070409402011-01-23T05:32:40.565-05:002011-01-23T05:32:40.565-05:00Ernie, I think we could all learn a lot by revisit...Ernie, I think we could all learn a lot by revisiting your QM/XLE pair that you entered Sept 2006. You wrote an update on Jan 2007 that you were still in the trade after 104 days. By looking at the chart of USO and XLE it appears that it took about 500 days for that pair to revert. <br><br>When the half life of 70 days was exceeded, the damage was already done. At that time the expectation for further drawdown must have been much smaller than the expectation of reversion (and history did indeed unfold as per such expectations).<br><br>How long did you hold that trade? If the same setup occurred today would you enter it again? What can you teach us about that trade in retrospect?Kenhttps://www.blogger.com/profile/15183628976507231041noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-85414853542197466512009-08-27T11:22:48.505-04:002009-08-27T11:22:48.505-04:00jh,
It is very possible that USO-XLE are no longer...jh,<br />It is very possible that USO-XLE are no longer cointegrated. We update our pairs every so often, and remove those pairs that fall out of cointegration.<br />ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-25855065879604779552009-08-26T00:21:48.772-04:002009-08-26T00:21:48.772-04:00Hi -
I'm wondering what the matlab cointegrat...Hi -<br /><br />I'm wondering what the matlab cointegration statistics are saying? Using the USO-XLE as an example, I just downloaded the last 3.5 years of data. The regression shows the ratio to be +100 USO, -154 XLE. But using the tseries package, an ADF and PP test show very high p-values, which suggests this series is no longer cointegrated. Which tests does the matlab cointegration package use?jhhttps://www.blogger.com/profile/04272888206881641788noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-52696225309128993762009-02-28T09:16:00.000-05:002009-02-28T09:16:00.000-05:00Corey,If we compute cointegration using only the l...Corey,<BR/>If we compute cointegration using only the last year or two data on SPY and XLE, they do seem cointegrated, but not so if you use longer periods. I don't believe cointegration test using only 2 years of data is reliable enough for a good trading strategy. The cointegration may fall apart in the future.<BR/><BR/>I am not familiar with R. I think Google probably will have a better recommendation!<BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-3654126226428534562009-02-27T13:16:00.000-05:002009-02-27T13:16:00.000-05:00Ernie,I was wondering what you thought about the a...Ernie,<BR/>I was wondering what you thought about the apparent recent cointegration between XLE and SPY. <BR/>Also, could you reccomend a cointegration package for R? Thanks.<BR/><BR/>CoreyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-83067312836594776882008-03-25T17:37:00.000-04:002008-03-25T17:37:00.000-04:00Anonymous,Generally, a dynamically adapted hedge r...Anonymous,<BR/>Generally, a dynamically adapted hedge ratio based on a certain lookback period has better trading performance than a static ratio. I have not tried the different methods of dynamically adapting the hedge ratio -- I have only used the linear regression method as it is more theoretically sound.<BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-563745519026124482008-03-23T21:51:00.000-04:002008-03-23T21:51:00.000-04:00Ernie, I stumbled upon your blog and am reading wi...Ernie, <BR/>I stumbled upon your blog and am reading with great interest. I've noticed that you use a ratio for this pair trade based on the cointegration package from Matlab. How is this ratio any different in performance vs. just using a fixed dollar ratio for the pair as I have seen from other articles and bloggers on pair trading? Thx.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-91166649245017734512007-08-23T01:22:00.000-04:002007-08-23T01:22:00.000-04:00Ernie: This comment is simply regarding some prac...Ernie: This comment is simply regarding some practical aspects of this spread trade.<BR/><BR/>I've had good luck implementing one leg using the WTI crude oil futures on ICE; and the other leg using a combination of XLE single-stock futures (SSF) and out-right XLE shares. The beauty of using futures is that the trade is much less capital-intensive.<BR/><BR/>Note that the SSF for XLE is one <I>thousand</I> shares notional size, not one hundred like most SSFs. This is because XLE is an ETF.<BR/><BR/>For sizing, I simply choose a number of XLE shares to balance the dollar volatility of the WTI contract. Recently, that's meant 1130 shares of XLE for every WTI contract; or, using SSFs, one SSF plus 130 out-right shares for every WTI contract.<BR/><BR/>You can use the CL futures on NYMEX instead of WTI on ICE. But the WTI is cash-settled, making it much more convenient. And the CL futures expire <I>before</I> the delivery month, so you need to watch the calendar carefully.<BR/><BR/>This has been a very profitable trade, simply by entering on the extreme Z scores and covering when it returns near normal. I hope other readers can profit from your idea, too.Paul Teetorhttps://www.blogger.com/profile/07598717206066693795noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-89752777842549831852007-07-03T12:02:00.000-04:002007-07-03T12:02:00.000-04:00Dear anniyan,You can use any platform you like to ...Dear anniyan,<BR/><BR/>You can use any platform you like to do the analysis -- I am, however, not aware of a free R cointegration package, while there is one for Matlab.<BR/><BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-55805337189238168632007-07-03T11:35:00.000-04:002007-07-03T11:35:00.000-04:00EC, any reason why I shudn't go for R for cointegr...EC, any reason why I shudn't go for R for cointegration analysis?<BR/>It is freely available.Vivek Krishnamoorthyhttps://www.blogger.com/profile/08036766967142621229noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-50098659016864131922007-06-10T09:48:00.000-04:002007-06-10T09:48:00.000-04:00Dear anonymous,Thanks for the time-stamp suggestio...Dear anonymous,<BR/><BR/>Thanks for the time-stamp suggestion. It is done!<BR/><BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-36868831785521638032007-06-09T16:51:00.000-04:002007-06-09T16:51:00.000-04:00Ernie, is it possible to turn on dates for the com...Ernie, is it possible to turn on dates for the comments? It is interesting to see the development of stories over time. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-40610633519658594992007-03-08T07:51:00.000-05:002007-03-08T07:51:00.000-05:00Dear anonymous,Unfortunately, as of 3/7/07, the US...Dear anonymous,<BR/>Unfortunately, as of 3/7/07, the USO-XLE spread still stood at about -3 s.d. away from zero, though it is narrowing from its recent month's low. As I mentioned in a recent <BR/><A HREF="http://epchan.blogspot.com/2007/01/what-is-your-stop-loss-strategy.html" REL="nofollow">article</A>, it may take up to a year for it to converge.<BR/><BR/>The spread is defined as long 100 shares of USO vs short 122 shares of XLE.<BR/><BR/>ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-8243057104581889242007-03-07T17:23:00.000-05:002007-03-07T17:23:00.000-05:00how did the spread USO-XLE work out?did it return ...how did the spread USO-XLE work out?<BR/><BR/>did it return to 0?<BR/><BR/>what was the exact conintegration-relation you found?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-34182630511746699482006-12-25T18:53:00.000-05:002006-12-25T18:53:00.000-05:00I have not used scilab before so I am not qualifie...I have not used scilab before so I am not qualified to answer your questions, but my guess is that matlab packages work only on Matlab, O-matrix and Octave. Please feel free to email me for further questions.<br />-ErnieErnie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-47955283238621536312006-12-25T17:48:00.000-05:002006-12-25T17:48:00.000-05:00does the add-in for matlab work with scilab?does the add-in for matlab work with scilab?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-35364652.post-41038274679698011092006-11-09T09:22:00.000-05:002006-11-09T09:22:00.000-05:00Yaser: I can tell you the ratio for an XLE-USO spr...Yaser: I can tell you the ratio for an XLE-USO spread. (I haven't done the analysis for the OIH-USO spread.)<br />If you believe this spread is under-valued, and you want to buy 100 shares of XLE, then I would recommend shorting 81 shares of USO.<br /><br />Note that the long and short side is not exactly dollar-neutral -- the ratio is determined by the cointegration package. Note also the analysis is based on fixed number of shares. Unlike delta-hedging in options trading, no dynamic re-adjustment of number of shares are needed here as the value of the spread changes.Ernie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-20255649291648292132006-11-09T08:49:00.000-05:002006-11-09T08:49:00.000-05:00Matlab itself can be bought from www.matlab.com. T...Matlab itself can be bought from www.matlab.com. There is a student license which is much cheaper than the normal one. The cointegration package can be downloaded freely from <br />http://www.spatial-econometrics.com/Ernie Chanhttps://www.blogger.com/profile/02747099358519893177noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-70098568993768775222006-11-09T08:48:00.000-05:002006-11-09T08:48:00.000-05:00EC-
Also wanted to ask you if a trader is trading...EC-<br /><br />Also wanted to ask you if a trader is trading this pair trade, how does he hedge himself?<br /><br />What I like to do usually is- say I'm bullish on oil, in fact I'll tell you my position right now. I'm long OIH and going to short USO as a hedge.<br /><br />What I like to do is, say I've got 1000$ which I'll put into this hedged trade. If I believe higher probability is for oih to rise, I buy 700$ of OIH and short 300$ for XLE/USO. Do you think that's a good approach?NAhttps://www.blogger.com/profile/09308905056511377295noreply@blogger.comtag:blogger.com,1999:blog-35364652.post-50456286914640019232006-11-09T08:38:00.000-05:002006-11-09T08:38:00.000-05:00EC-
How can one get the Matlab package?EC-<br /><br />How can one get the Matlab package?NAhttps://www.blogger.com/profile/09308905056511377295noreply@blogger.com