I have a question about pairs trading

1 view (last 30 days)
Good Morning I watched the pairs trading webminar. I would like to ask if anyone can give me some information about the operation of certain parts of the code.
Is regression implemented in this part?
% 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));
-------------------------------------------------- -----------------------------------
I am also not clear about this part:
% 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 for your concern and time. Best regards, Caserta
  5 Comments
alessandro caserta
alessandro caserta on 11 Oct 2014
thank you very much for all your invaluable help.
alessandro caserta
alessandro caserta on 16 Oct 2014
Good morning
I ask you another little help.
I can not understand how they are calculated returns in this part of the code.
s (i: i + N-1, 1) = -reg1.coeff (2). * s (i: i + N-1, 2);
return = sum ([0 0; s (1: end-1, : ). * diff (series2) - abs (diff (s)) * cost / 2], 2);
the prices of the series that I have to examine must be standardized ?
thank you so much for your time and cooperation regards

Sign in to comment.

Answers (0)

Categories

Find more on Special Functions in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!