Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.
alecase
-
Content Count
2 -
Joined
-
Last visited
Posts posted by alecase
-
-
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 cooperation
Pairs Trading Matlab
in General Trading
Posted
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 cooperation
ps do you know where I can find some code on the pairs trading?