pairs trading strategy problem
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
good morning everyone
I'm developing a strategy of pairs trading. I found a part of a matlab on http://www.mathworks.com/matlabcentral/fileexchange/31060-cointegration-and-pairs-trading-with-econometrics-toolbox but I could not understand how it works
I don't understand how the final return is calculated in this part of the code.
r4 is the total return vector
'series' represents the prices of companies.
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);
r = sum([0 0; s(1:end-1, :) .* diff(series2) - abs(diff(s))*cost/2] ,2) title(['Final Return = ',num2str(sum(r4),3),'(',num2str(sum(r4)/mean(series2(1,:))*100,3),'%)'])
specifically I'd like to learn the reason of the division of sum(r4) to the mean.
(',num2str(sum(r4)/mean(series2(1,:))*100,3),'%)'])
thank you so much for your time and cooperation,
regards
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Transaction Cost Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!