Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Science, Math, and Philosophy
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2007, 09:31 PM
Chrisman886 Chrisman886 is offline
Senior Member
 
Join Date: Aug 2005
Location: Making money
Posts: 2,206
Default Mathematical Definition or Algorithm of a Drawdown

Given m real numbers {1 ... n} please provide a formula or algorithm to find the largest "drawdown." I'm having trouble formulating into words exactly what a drawdown is, but I have illustrated it in the below graph. A poor definition of "drawdown" would be "The distance between and peak and the lowest subsequent valley." The biggest drawdown in this graph is A-B, or (A-B)/A percent.

Edit: Right after I posted this I came up with an algorithm, but there may be more efficient versions. I'm interested in how you guys approach this.

Reply With Quote
  #2  
Old 10-31-2007, 09:55 PM
onesandzeros onesandzeros is offline
Senior Member
 
Join Date: Nov 2006
Location: Your Mind
Posts: 220
Default Re: Mathematical Definition or Algorithm of a Drawdown

Drawdown

= max [ sum[r(t)] ] - r(t)
t = 0..T


Maximum Loss

Given a time series with N log returns r(t) over t = 1 to T, we can define...

= min [r(1), r(1)+r(2), r(1)+r(2)+r(3), ..., r(1)+...+r(N)]

= min [ sum [r(i)] ]
t=0..N i=1..t

In words: The minimum cumulated return from the beginning in a certain time period.

Maximum Drawdown

The maximum drawdown can be loosely defined as the largest drop from a peak to a bottom in a certain time period.

Maximum drawdown captures a path-dependant feature of a time series which is not represented in the histogram of the return time series.

= min [r(1), r(1)+r(2), r(1)+r(2)+r(3), ..., r(1)+...+r(N),
r(2), r(2)+r(3), r(2)+r(3)+r(4), ..., r(2)+...+r(N), ..., r(N)]

= min [ sum [r(j)] ]
i=1..t, t=1..N j=i..t

In words: The minimum cumulated return from any beginning points over a certain time period.

= max [ Drawdown(t) ]
t=0..T

...the last formula yields the end-point of the maximum
drawdown period. The starting point is found at the
last time point Drawdown(t) was equal to zero.

Maximum drawdown is always smaller than or equal to the difference between maximum loss and maximum gain.

Maximum loss & gain are the global extreme values, maximum drawdown is a concept base on the local minimum of a return time series.

Maximum drawdown is often used when not enough observations are available to calculate volatility measures (like for example standard deviation).

Maximum drawdown is highly dependent on the time interval chosen (annual, monthly, daily and so on) as well as the observation period.


Source ---> http://www.andreassteiner.net/performanceanalysis/?Risk_Measurement:Absolute_Riskrawdown
Reply With Quote
  #3  
Old 10-31-2007, 10:00 PM
Phil153 Phil153 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 4,905
Default Re: Mathematical Definition or Algorithm of a Drawdown

There's no formula for this since the data could be anything. All you can do is traverse the dataset looking at two items at a time.

Is this going to be written in code? If so, here's a sample algorithm in c (completely untested):
<font class="small">Code:</font><hr /><pre>
double[] d; // contains an array of the data

double currentlowest = 0;
double currenthighest = 0;
int largestdrawdownstartindex = 0;
int largestdrawdownendindex = 0;
int currentdrawdownstartindex = 0;
int currentdrawdownlowestindex = 0;
double largestdrawdownheight = 0;

for(int i = 0; i&lt;d.length;++i) // loop through each element of the data
{
// If data is higher than or equal to our current highest point, we either have a continuing upward trend or the end of a drawdown.
if(data[i] &gt;= currenthighest)
{
if(lowest &lt; currenthighest)
{
int drawdownheight = currenthighest - currentlowest;

// If biggest drawdown, save details
if(drawdownheight &gt; largestdrawdownheight)
{
largestdrawdownheight = drawdownheight;
largestdrawdownstartindex = currendrawdownstartindex;
largestdrawdownendindex = currentdrawdownlowestindex;
}
}
// reset values

currenthighest = data[i];
currentdrawdownstartindex = i;
currentlowest= data[i];
currentdrawdownlowestindex = i;

}
if(data[i] =&lt; currentlowest) {
currentlowest = data[i]};
currentdrawdownlowestindex = i;
}
}

</pre><hr />

The are no really useful optimizations that I can think of (at least starting with a dataset) since any single point can destroy the drawdown.
Reply With Quote
  #4  
Old 10-31-2007, 10:18 PM
Subfallen Subfallen is offline
Senior Member
 
Join Date: Sep 2004
Location: Worshipping idols in B&W.
Posts: 3,398
Default Re: Mathematical Definition or Algorithm of a Drawdown

So, given a_0...a_n, you're looking for the monotonically decreasing subsequence a_i...a_j such that (a_j - a_i) is a maximum?

If that's problem, you just need one iteration through the array, looking for contiguous decreasing subsequences as you go and remember the one that had the biggest "drawdown."

If you're trying to find a not necessarily monotonic subsequence that approximates the most visually striking "drawdown"...that is quite a bit harder, and probably requires heuristics.
Reply With Quote
  #5  
Old 10-31-2007, 10:22 PM
Chrisman886 Chrisman886 is offline
Senior Member
 
Join Date: Aug 2005
Location: Making money
Posts: 2,206
Default Re: Mathematical Definition or Algorithm of a Drawdown

Yeah, I was thinking of a similar algorithm in log(n) time. Looks like it is the most efficient. Thanks for the help.
Reply With Quote
  #6  
Old 10-31-2007, 10:25 PM
Chrisman886 Chrisman886 is offline
Senior Member
 
Join Date: Aug 2005
Location: Making money
Posts: 2,206
Default Re: Mathematical Definition or Algorithm of a Drawdown

[ QUOTE ]
So, given a_0...a_n, you're looking for the monotonically decreasing subsequence a_i...a_j such that (a_j - a_i) is a maximum?


[/ QUOTE ]

You got it. It's the math language I was missing. I really should have taken more algorithms classes in college, it really is a fascinating subject and I believe helps you think outside the box.
Reply With Quote
  #7  
Old 10-31-2007, 10:45 PM
tshort tshort is offline
Senior Member
 
Join Date: May 2005
Posts: 1,143
Default Re: Mathematical Definition or Algorithm of a Drawdown

[ QUOTE ]
[ QUOTE ]
So, given a_0...a_n, you're looking for the monotonically decreasing subsequence a_i...a_j such that (a_j - a_i) is a maximum?


[/ QUOTE ]

You got it. It's the math language I was missing. I really should have taken more algorithms classes in college, it really is a fascinating subject and I believe helps you think outside the box.

[/ QUOTE ]

From your graph, A to B is not monotonically decreasing.
Reply With Quote
  #8  
Old 10-31-2007, 11:00 PM
jason1990 jason1990 is offline
Senior Member
 
Join Date: Sep 2004
Posts: 932
Default Re: Mathematical Definition or Algorithm of a Drawdown

Define b_j = max(a_1,...,a_j) - a_j. The biggest drawdown is max(b_1,...,b_n).
Reply With Quote
  #9  
Old 11-01-2007, 10:59 PM
jogsxyz jogsxyz is offline
Senior Member
 
Join Date: Mar 2005
Posts: 1,167
Default Re: Mathematical Definition or Algorithm of a Drawdown

There's a formula out there something.
Look up Markov processes.
For losing players it's the entire bankroll.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.