Pairs trading matlab (1 Viewer)

buongiorno a tutti
ho visto il suo Webinar sul pairs trading
volevo chiedere se qualcuno gentilmente mi può dare delle delucidazioni sul funzionamento di alcune parti del codice.
questa parte del codice fa una regressione?
% 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));
-------------------------------------------------------------------------------------
Non mi è chiaro cosa faccia questa parte di codice
% 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.
indicate(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
grazie a tutti per la collaborazione

Ps sapete dove posso trovare qualche altra parte di codice per il pairs trading?
 
Ultima modifica:

Users who are viewing this thread

Alto