pairs trading strategy problem
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transaction Cost Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!