This is a discussion on Co-integration and pairs trading within the Trading Systems forums, part of the Trading Methods category; Oh yeah, and you'll find Dickey-fuller test in R, of course....

 Sep 2, 2008, 7:29am #9 Rookie     Member Since Aug 2008 Re: Co-integration and pairs trading Oh yeah, and you'll find Dickey-fuller test in R, of course.
 Sep 2, 2008, 7:50am #10 Banned     Member Since Nov 2007 Re: Co-integration and pairs trading Recorded Webinars by Application Register and watch the Algorithmic Trading with MATLAB for Financial Applications webinar. There is an example of pairs trading... very impressive indeed. P.S. Courtesy of 52aces
 Sep 4, 2008, 1:16pm #11 Rookie     Member Since Jul 2005 Re: Co-integration and pairs trading msardelich, I would have to agree with MrGecko, the MATLAB webinar is superb and there is code support on the MATLAB central website. You can use the Dickey-Fuller or ADF test for cointegration if you're sure you have an exact method to linearly combine the two series. The DF/ADF test is primarily used to test for a unit root in one series. Much better to use the Engle-Granger 2-step or Engle & Yoo 3 step approach. You could use Johannsen, but it would be overkill seeing as you're only comparing two series at any one time. Best of Luck.
 Nov 13, 2008, 8:23pm #12 Newbie     Member Since Jun 2008 Re: Co-integration and pairs trading I'm implementing co-integration with Matlab on all of the stock time-series, contact me if you are interested, safe.fore@gmail.com
 Nov 16, 2008, 5:41pm #13 Member     Member Since Oct 2008 Re: Co-integration and pairs trading Here is a good guide to pairs trading and co-integration issues (has the math but is readable if you are not mathematician): Pairs Trading, Convergence Trading, Cointegration
 Aug 3, 2010, 10:13am #14 Member     Member Since Apr 2009 Re: Co-integration and pairs trading You could just write your own solution to in C++/C#/Java too. The DF measure is useful but there are cruder methods which may be easier to implement. For example remembering that two co-integrated time series can be combined into a linear combination with constant SD and Mean. You could just create your optimal linear combination using linear regression then divide your data into say five samples and compare the SD and Mean for consistency. In other words we are looking for a small SD(SD) and SD(Mean). Crude but easy to program.