Serving the Quantitative Finance Community

 
User avatar
milano
Topic Author
Posts: 0
Joined: August 6th, 2014, 11:50 am

Matlab Pairs trading

October 7th, 2014, 1:36 pm

Good morning everyone I saw a pairs trading webinar on the topic and found this code. I can not understand these two pieces of code, anyone is kind enough to explain % The strategy: % 1 Compute residuals over next N days res = series2 (i: i + N-1, 1) ... - (Reg1.coeff (1) + reg1.coeff (2). * Series2 (i: i + N-1, 2)); % 2 If the residuals are large and positive, then the first series % Is Likely to decline vs. the second series. Short the first % Series by a scaled number of shares and long the second series by 1% share. If the residuals are large and negative, do the % Opposite. indicated (i: i + N-1) = res / reg1.RMSE; s (i: i + N-1, 2) = (res / reg1.RMSE> spread) ... - (Res / reg1.RMSE <-spread); s (i: i + N-1, 1) = -reg1.coeff (2). * s (i: i + N-1, 2); end end Thank you very much for your cooperationps do you know where I can find some code on the pairs trading?
 
User avatar
tags
Posts: 3162
Joined: February 21st, 2010, 12:58 pm

Matlab Pairs trading

October 7th, 2014, 1:57 pm

It seems to me say there is nothing Matlab-specific in the snippets above, the '%' comment sign excepted.BTW pair trading is not a specific 'technique' (in its common basic form, at least). It is a set of trading rules (buy/sell).
 
User avatar
januszopechowski
Posts: 0
Joined: October 4th, 2015, 3:31 pm

Matlab Pairs trading

October 5th, 2015, 3:26 pm

Hi.Find this book :Algorithmic Trading: Winning Strategies and Their Rationale , say here : http://eu.wiley.com/WileyCDA/WileyTitle ... 146.htmlor find some another free web edition.There login and password to authors page.There are plenty of matlab examples.
 
User avatar
januszopechowski
Posts: 0
Joined: October 4th, 2015, 3:31 pm

Matlab Pairs trading

October 5th, 2015, 3:28 pm

Ups I missed like 5 yrs :)))