has anybody developed an excel macro

Discussions about Money Management and Risk Control.
Post Reply
smodato
Senior Member
Senior Member
Posts: 27
Joined: Wed Jul 14, 2004 2:53 am

has anybody developed an excel macro

Post by smodato »

Hi, I was mixing and remixing data un some excel files and I was starting to think about the development of a macro do calculate the drawdown of an equity.
So I suppose I have the equity sotred trade by trade in the cells of my spreadsheet, I can graph it and from the graph evalutae the maximum drawdonw, it would be nice anyway to get the info elsewhere and maybe with some more details.
Before starting my visualbasic adveture I thought it would be better to ask whether something similar is already available.
Thanks, bye
smodato
bazzacontango
Contributing Member
Contributing Member
Posts: 7
Joined: Sun Dec 19, 2004 7:41 pm

Post by bazzacontango »

Maybe a little late but I've wrote a macro/sheet that calcs drawdown%, sharpe, sortino, RRR and Ave%worstDD, and can post if you're still interested.
smodato
Senior Member
Senior Member
Posts: 27
Joined: Wed Jul 14, 2004 2:53 am

Post by smodato »

Thanks for your reply, I'm still very much interested in the matter so, if it is no problem, please post your solution.
Bye and thanks
Smodato
bazzacontango
Contributing Member
Contributing Member
Posts: 7
Joined: Sun Dec 19, 2004 7:41 pm

Post by bazzacontango »

OK, here's the spreadsheet, I've included Mark Johnson's "Thirteen" equity curve for an example of use. Appreciate any feedback from you or any else who uses it.

Read the Notes then press the button "Calc Ratios" on the "Go" sheet.

Cheers.

Fixed an error in drawdown calc and added drawdown length.
Attachments
Equity_Statistics.zip
Equity_Statistics.xls is an Excel2002 spreadsheet, (~551KB)
(180 KiB) Downloaded 1600 times
Last edited by bazzacontango on Wed Jan 19, 2005 7:15 am, edited 1 time in total.
smodato
Senior Member
Senior Member
Posts: 27
Joined: Wed Jul 14, 2004 2:53 am

Post by smodato »

Thanks, very much, I launche the macro on the file as downloaded and I got an error, run time 1004, the debugger showed this:
Selection.Sort Key1:=Range("M10"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal inMrk Johnson's average of 5 worst DD calculation.
I will look into the code to understand it, it is a great job anyway, I'm sure it will help my analyses very much.

Bye
Smodato
bazzacontango
Contributing Member
Contributing Member
Posts: 7
Joined: Sun Dec 19, 2004 7:41 pm

Post by bazzacontango »

I don't know why you received that error.

Did it ask to open as read-only, say no if it does.

You could replace that section of code with a bubble-sort routine. I was lazy and just used the excel application sort.
smodato
Senior Member
Senior Member
Posts: 27
Joined: Wed Jul 14, 2004 2:53 am

Post by smodato »

Hi, I tried again with different time frames as input but again and again the same mistake, I said both Yes and No to read only open but no change even.
In any case I will look into the macro and try to get out what I need, if I can find out why the error occurs I will come back to you.
Bye
Smodato
bazzacontango
Contributing Member
Contributing Member
Posts: 7
Joined: Sun Dec 19, 2004 7:41 pm

Post by bazzacontango »

An updated version of the spreadsheet has been uploaded.

It fixes an issue with the drawdown initialization and added drawdown length calculation.

Note: the drawdown lengths and dates are sorted by longest drawdown, and do not correspond to the deepest drawdowns. So ddindex 1 row, has the deepest% and the longest in calendar days.
Post Reply