Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Science, Math, and Philosophy

Notices

Science, Math, and Philosophy Discussions regarding science, math, and/or philosophy.

Reply
 
Thread Tools Display Modes
Old 10-31-2007, 10:31 PM   #1
veteran
 
Chrisman886's Avatar
 
Join Date: Aug 2005
Location: Brooklyn, NY
Posts: 2,537
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.

Chrisman886 is offline   Reply With Quote
Old 10-31-2007, 10:55 PM   #2
grinder
 
onesandzeros's Avatar
 
Join Date: Nov 2006
Posts: 589
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
onesandzeros is offline   Reply With Quote
Old 10-31-2007, 11:00 PM   #3
Carpal \'Tunnel
 
Join Date: Oct 2005
Posts: 7,333
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.
Phil153 is offline   Reply With Quote
Old 10-31-2007, 11:18 PM   #4
Carpal \'Tunnel
 
Subfallen's Avatar
 
Join Date: Sep 2004
Location: farther back
Posts: 6,653
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.
Subfallen is offline   Reply With Quote
Old 10-31-2007, 11:22 PM   #5
veteran
 
Chrisman886's Avatar
 
Join Date: Aug 2005
Location: Brooklyn, NY
Posts: 2,537
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.
Chrisman886 is offline   Reply With Quote
Old 10-31-2007, 11:25 PM   #6
veteran
 
Chrisman886's Avatar
 
Join Date: Aug 2005
Location: Brooklyn, NY
Posts: 2,537
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?

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.
Chrisman886 is offline   Reply With Quote
Old 10-31-2007, 11:45 PM   #7
old hand
 
Join Date: May 2005
Posts: 1,217
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?

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.
From your graph, A to B is not monotonically decreasing.
tshort is offline   Reply With Quote
Old 11-01-2007, 12:00 AM   #8
old hand
 
Join Date: Sep 2004
Posts: 1,875
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).
jason1990 is offline   Reply With Quote
Old 11-01-2007, 11:59 PM   #9
Carpal \'Tunnel
 
jogsxyz's Avatar
 
Join Date: Mar 2005
Posts: 6,362
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.
jogsxyz is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -4. The time now is 05:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright 2008-2010, Two Plus Two Interactive