loop for backtesting

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

loop for backtesting

wintwin111
First of all sorry for my bad english but its not my native language.

I am working on a paper on Portfolio Optimization with Markowitz and Lower Partial Moments.

I want to compare the returns of the minimum variance portfolios from booth methods. First of all i have an in-sample multivariate timeseries from 4 stocks reaching from 1.october.2011 to 1.october 2012 (log-returns, daily data, 257 observations for each stock).

I start to optimize my portfolio using the package tseries as follow:

portfolio.optim(x,pm=mean(x),riskless=F,rf=0,shorts=F,reslow=NULL,reshigh=NULL,covmat=cov(x))

with this i get the weights, the mean return of the whole period, the standard deviation and the returns on each day for my in-sample optimal portfolio Markowitz portfolio.

The out of sample data reaches from 2.october.2012 to 1.october.2013 (log-returns,daily data, 253 observations for each stock, again a multivariate time series). Now i want to optimize the Portfolio 253 times. Each time the log-returns for one day should be added to the original in-sample timeseries (first optimization 257 in-sample data plus the first from the out of sample data and so on). Now i should get new weights for every of the 253 periods and therefor new returns for the portfolio every period.

My advisor at the university told me i cant use backtest packages cause they cant handle the Lower Partial Moments part of my analysis. The problem is just for the markowitz portfolio optimization.

I hope you can help me with my problem

greetings wintwin111