Hi all, I have a matrix called ETNWED which is a set of historical prices of 34 Shares. The size is 294x34 where there is 295 weeks and 34 shares, and the entries are their prices.
Ok additionally I have a matrix called Returns, which is the MONEY MADE at each time and for each share. This is also size of 294x34. So lets say for instance in Returns(10,2) =2. This mean that in week 10 our share number 2 made 2 dollars.
Now I want to produce a final return after 294 weeks. I am quite confused on how to do this.
My initial method was:
- Every week (ie, for i=1:294) do the sum of money made (ie sum of rows of returns) / sum of money invested (so this is the sum of the rows of ETNWED (but only the sum of the values which generated a return)).
Then I just added 1 and then did Prod of all of this to get final return.
If somebody can give me some advice I would really appreciate it.