I have four series of security prices, which should be combined to an index. The weights of the index should be set that the ratio of the mean to the standard deviation of the index returns is maximized. The restrictions on the weights are to be positive and to add-up to unity.
I have tried the following code
Code: Select all
nonlin(parmset=base) w1 w2 w3 w4
nonlin(parmset=constraint) w1>=0.0 w2>=0.0 w3>=0.0 w4>=0.0 w1+w2+w3+w4==1.0
*
comp w1=0.80
comp w2=0.10
comp w3=0.05
comp w4=0.05
*
* calculate the price of the index
*
set index = log(w1*s1+w2*s2+w3*s3+w4*s4)
set ret = 100*(index-index{1})
statistics(noprint) ret
comp mw = %mean
set retsq = (ret-mw)**2
statistics(noprint) retsq
comp std =sqrt(%mean)
frml sharpe = mw/std
maximize(parmset=base+constraint,method=simplex,iters=400) sharpe
Thank you for any help to solve my problem.
Best regards
Peter