investment-performance.com

investment-performance.com (http://www.investment-performance.com/forums/index.php)
-   CompoundingHappens.com (http://www.investment-performance.com/forums/forumdisplay.php?f=62)
-   -   calculating max drawdown (http://www.investment-performance.com/forums/showthread.php?t=459)

alexm 22nd November 2007 06:47

calculating max drawdown
 
Hi,

I am trying to build a calculator for a high school computer project similar to this one: http://www.performance-measurement.org/performance.php

However the max drawdown function there does not seem to work (I have contacted the author but have not heard from him yet). I put in: 90, 80, 70, 60, 45, 55, 65, 90, 100, 95, 80, 110

So the max drawdown should be 50 % but it returns zero. I am having problems in finding a decent formula to properly compute max drawdown. Maybe someone in this forum could help. I am also trying to find a workable formula for drawdown analysis which returns depth, length, recovery as well as start and end date.

I also tried to calculate the highest and lowest 12 months in a record, but again I am struggling to find an easy to implement formula.

Thanks in advance.

Damien Laker 22nd November 2007 15:41

Advice from an old fogey
 
It makes me feel very old to say this, but what you are seeking is definitely an algorithm, not a formula. The bit that makes me feel very old is that I finished my computer science degree a quarter of a century ago. I can imagine Abe Simpson (Bart's Grandpa) saying this, but in my day, this is the sort of problem that we would have solved by writing an algorithm in Pascal using pencil and paper. Honestly, I can see the outline of the solution now. It involves 2 or 3 subroutines, and a bit of iteration in the main procedure -- most likely one for loop nested inside another, like:

for integer i = 1 to n
{
__for integer j = i to n
__{
__// This is where the main body of the logic would go.
__}
}

Yes, I know this is not Pascal. You can use any sensible notation to describe your algorithm. The leading underscores are simply because this discussion group software doesn't seem to like leading spaces or tabs.

I don't think there is any difficult performance analysis knowledge in this problem. Anybody bright enough to write the algorithm should be able to figure out that bit by themselves.

[Lapsing completely into Abe Simpson character...]
We used to solve a dozen problems like this in a one-hour tutorial. And we were grateful. :-)


All times are GMT -5. The time now is 09:14.

Powered by: vBulletin Version 3.0.1