For loop with moving window
Hi
I want to create a for-loop that calculates the weights of portfolios using a moving window for the period I am investigating. The moving window should move one day at a time and there are 1000 days in the window.
For example, compute the optimal weights on day1001 based on observations for period 1-1000days. Then you move on to day 1002, and re-calculate the weights, based on observations for period 2-1001days, etc.
I have a matrix of returns (Rets) that is 3740×6. The first column has the dates and the rest of the columns have daily returns for five different asset classes.
Thanks!Hi
I want to create a for-loop that calculates the weights of portfolios using a moving window for the period I am investigating. The moving window should move one day at a time and there are 1000 days in the window.
For example, compute the optimal weights on day1001 based on observations for period 1-1000days. Then you move on to day 1002, and re-calculate the weights, based on observations for period 2-1001days, etc.
I have a matrix of returns (Rets) that is 3740×6. The first column has the dates and the rest of the columns have daily returns for five different asset classes.
Thanks! Hi
I want to create a for-loop that calculates the weights of portfolios using a moving window for the period I am investigating. The moving window should move one day at a time and there are 1000 days in the window.
For example, compute the optimal weights on day1001 based on observations for period 1-1000days. Then you move on to day 1002, and re-calculate the weights, based on observations for period 2-1001days, etc.
I have a matrix of returns (Rets) that is 3740×6. The first column has the dates and the rest of the columns have daily returns for five different asset classes.
Thanks! for loop, moving window, portfolio optimization, rebalancing MATLAB Answers — New Questions