How to convert the following data into zoo/xts/tseries object to calculate maximum drawdown by using the function Return.calculate and Maxdrawdown function?
Hello friends i have equity(eg CENTURYTEX,AAPL,RIL etc) specific eod prices for around 400 equities in a single csv.
I want to calculate maximum drawdown. To calculate returns i am trying
ret=by[ddr3csv[,4],ddr3csv[,2],
function(x)Return.calculate(x,method="simple")]
which is giving 'closure' is not subsettable' error.
Once returns are obtained finding maximum drawdown will be easy.I am searching for the error but not able to figure out much.
rownum name code date price readings
86916 CENTURYTEX 500040 11/04/2011 364.60 2994
86917 CENTURYTEX 500040 13/04/2011 376.70 2994
86918 CENTURYTEX 500040 15/04/2011 370.90 2994
86919 CENTURYTEX 500040 18/04/2011 365.85 2994