Hi,
I am currently trying to optimize a portfolio based on the risk measure value at risk (VaR) with the optimization toolbox. I know that the conditional value at risk does have better mathematic properties and so on, but I still need the VaR optimization (optimal asset allocation) for comparison.
So far I tried the following code for my 29 analyzed assets:
m=mean(Returns)cv=cov(Returns)m1 = [m.Adidas, m.Allianz, ...]ValueatRiskE = 0 * ones(1,29);for i=1:29ValueatRiskE(i) = quantile(tick2ret(DAX30(:,i)),0.05)endpwgt2 = 1/29 * ones(1,29);
Until this point I have the mean of my 29 assets m1 and a vector ValueatRiskE (29*1) that contains each individual VaR per asset. Additionally I have a naive diversification vector pwgt2 = [1/29 1/29 .. 1/29] that could be the starting allocation for my optimization problem.
Now I want to optimize the following problem:
max Value = (ExpectedReturn-r0)/ValueatRiskPortfolio
where
ExpectedReturn = sum(pwgt2.*m1)ValueatRiskPortfolio = [sqrt(pwgt2*cv*pwgt2')]*1.96r0=0.00002
Can I now use the following optimization function to get the optimal allocation pwgt2*?
function s = sharp(pwgt2,cv,m1)s = {sum(pwgt2.*m1)-r0]/sqrt(pwgt2*cv*pwgt2'); end
I tried to enter the objective function "@s", the start point "pwgt2" and the constraints sum(pwgt2)=1 in the optimization toolbox, but it doesnt work. How can I solve this problem?
Thank you in advance for your help! 🙂
Greets, phanta
Best Answer