Closed Thread
Results 1 to 21 of 21

Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

  1. #1
    Registered User
    Join Date
    01-18-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    18

    Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hi, please see attached spreadsheet with data (col A, B & C) including expected results (col F & col G).

    I have an 'equity curve' (col B) which has multiple peaks and troughs (troughs highlighted). I have calculated the drawdown % and size in col C and Col D, which by definition is the difference between a High and the following lowest Low before a new Equity high is made.

    I would love some help working out formula's to calculate the following:

    1) The Maximum drawdown for each particular drawdown phase (not just the Maximum drawdown for the entire data series)

    2) The length (in days) of each drawdown phase ie. from first drawdown to recovery. Recovery is defined as the point where equity reaches the previous high.

    I've scoured many forums and there are similar posts/solutions but I can't quite find the answers to the above.

    Any help is greatly appreciated!

    thanks very much



    (also posted in http://www.ozgrid.com/forum/showthre...241#post737241)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,305

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    In F3, array enter (enter using Ctrl-Shift-Enter) the formula

    =IF(AND(C2<0,C3=0),MIN(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),$C$2:C3)),"-")

    and in G3, array enter

    =IF(AND(C2<0,C3=0),SUM(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),1)),"-")

    and copy both down to match your draws.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    01-18-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    18

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Thanks very much Bernie, that's exactly what i'm looking for!

    Much appreciated.

  4. #4
    Registered User
    Join Date
    01-18-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    18

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hi Bernie, (please see attached; expected result in cell H116, your formula 1 added to Col F)

    There's one more thing I'd love formula 1 to do. The data series finishes whilst still in a drawdown, therefore no "Max Draw" stat is generated for that particular draw period (C80:C116), and rightly so because by definition a new high has not been made.

    However is it possible to add to the formula so that the Max Draw in the current Draw Period shows until a new Equity high has been reached? ie. -118% is produced in cell H116 or H117

    Currently the stats produced are reflective of each Draw Period except for the final Draw Period.

    Thanks very much
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,305

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    We just need to look for the final blank by changing the conditions.

    n F3, Array enter (enter with Ctrl-Shift-Enter)

    =IF(OR(AND($C3<0,$C4=""),AND($C2<0,$C3=0)),MIN(IF(ROW($C$2:$C3)>MAX(IF($C$1:$C2=0,ROW($C$1:$C2))),$C$2:$C3)),"-")

    and in G3

    =IF(OR(AND($C3<0,$C4=""),AND($C2<0,$C3=0)),SUM(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),1)),"-")

    and copy down, of course.

  6. #6
    Registered User
    Join Date
    05-05-2015
    Location
    NYC, US
    MS-Off Ver
    2007
    Posts
    1

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hi, I need help with calculating the following:
    1) The Maximum drawdown for each particular drawdown phase (not just the Maximum drawdown for the entire data series)
    2) The length (in days) of each drawdown phase ie. from first drawdown to recovery.

    An example spreadsheet would be greatly appreciated!
    Thanks!

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,305

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    The example spreadsheet with my formulas added does just that, IIRC.

  8. #8
    Registered User
    Join Date
    05-22-2016
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    4

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hello,

    this thread was really helpful for me calculating the DD recovery time.
    But I also want to calculate the drawdown length which means the length from a peak to its valley.
    The solution given here only calculates the recovery time which means the time from one peak until it reaches the same height again.

    Any help appreaciated.

    Kind regards
    Last edited by Ksisissk; 07-05-2016 at 04:00 PM.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Ksisissk welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Registered User
    Join Date
    05-22-2016
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    4

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Thanks for your reply! Opened a new thread here: http://www.excelforum.com/showthread...54#post4426654

  11. #11
    Registered User
    Join Date
    01-18-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    18

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hi Bernie, sorry for revisiting such an old post, but I was wondering if you could assist me tweaking the 2nd formula you provided very slightly.

    I would actually like the answers in column I to be 1 less than they currently are, besides the final result which is correct. I have amended the spreadsheet and highlighted the changes.

    I simply want to count the the number of negative periods (column C) that occur in a row, within each phase.

    Is this possible and hopefully easily done?

    Thanks so much in advance, any help is much appreciated!
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,305

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    You can just tack on a -1 to the end of the calculation part of the formula:

    =IF(Condition, calculation,"-")

    =IF(Condition, calculation-1,"-")

    Just remember to re-enter the formula using Ctrl-Shift-Enter, and then copy down to over-write all the old formulas.

  13. #13
    Registered User
    Join Date
    01-18-2015
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    18

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Great, thanks very much Bernie. I will amend all the formulas except for the very final calculation. It seems to work!

    Appreciate your help.

  14. #14
    Registered User
    Join Date
    05-21-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2007
    Posts
    10
    Hi Bernie,

    Could you please walk me through the logic of the formulas which you described, and explain what each function does?

    I am trying to understand your formula, rather than blindly copying them. I have not been able to figure them out.

    Quote Originally Posted by Bernie Deitrick View Post
    In F3, array enter (enter using Ctrl-Shift-Enter) the formula

    =IF(AND(C2<0,C3=0),MIN(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),$C$2:C3)),"-")

    and in G3, array enter

    =IF(AND(C2<0,C3=0),SUM(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),1)),"-")

    and copy both down to match your draws.

  15. #15
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,305

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    =IF(AND(C2<0,C3=0),MIN(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),$C$2:C3)),"-")

    The logic that was required was finding the minimum value in C, restricted to values after the previous zero value, returned only when the values in C go from negative to 0.

    So the first part:

    AND(C2<0,C3=0)

    checks for a negative value in the row above, and a 0 in the current row. (Remember, the formula is written for row 3) - if that is not met, then the formula shows "-"

    This part finds the row of the latest 0 value above the current 0 value:

    MAX(IF($C$1:C2=0,ROW($C$1:C2)))

    Let's call that XXX, so we have this

    IF(ROW($C$2:C3)>XXX,$C$2:C3)

    which returns an array of values from the rows > XXX, which then is used to find the MIN value

    MIN(Array of Values)

    You really should download the file as well, then evaluate the formula by parts.

  16. #16
    Registered User
    Join Date
    08-27-2018
    Location
    MA
    MS-Off Ver
    2010
    Posts
    4

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    This was a great help, i have one more question which I will post in a new thread. Thx

  17. #17
    Registered User
    Join Date
    08-24-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Quote Originally Posted by Bernie Deitrick View Post
    =IF(AND(C2<0,C3=0),MIN(IF(ROW($C$2:C3)>MAX(IF($C$1:C2=0,ROW($C$1:C2))),$C$2:C3)),"-")

    The logic that was required was finding the minimum value in C, restricted to values after the previous zero value, returned only when the values in C go from negative to 0.

    So the first part:

    AND(C2<0,C3=0)

    checks for a negative value in the row above, and a 0 in the current row. (Remember, the formula is written for row 3) - if that is not met, then the formula shows "-"

    This part finds the row of the latest 0 value above the current 0 value:

    MAX(IF($C$1:C2=0,ROW($C$1:C2)))

    Let's call that XXX, so we have this

    IF(ROW($C$2:C3)>XXX,$C$2:C3)

    which returns an array of values from the rows > XXX, which then is used to find the MIN value

    MIN(Array of Values)

    You really should download the file as well, then evaluate the formula by parts.
    This is really, really excellent. Thank you, Bernie, for working that out and explaining in a clear manner.

  18. #18
    Registered User
    Join Date
    03-25-2021
    Location
    Zurich
    MS-Off Ver
    365
    Posts
    1

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    How can the formula be modified to deal with a descending date sequence , as in today in A3 and descending from there? The formula works great to ascending dates but not for descending - gives a value of 0 for each correctly identified end of a drawdown phase. Regards to all
    Last edited by elliot5; 03-25-2021 at 06:31 AM.

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Quote Originally Posted by elliot5 View Post
    How can the formula be modified to deal with a descending date sequence , as in today in A3 and descending from there? The formula works great to ascending dates but not for descending - gives a value of 0 for each correctly identified end of a drawdown phase. Regards to all
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

  20. #20
    Registered User
    Join Date
    03-06-2024
    Location
    India
    MS-Off Ver
    2023
    Posts
    9

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Hi, I have an observation - the length of drawdowns calculated here considers the no. of rows which are essentially trading days and not the actual calendar days. Shouldn't actual calendar days be considered? Would be helpful if you could share the formula for that. Thanks!

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,265

    Re: Drawdown- calculate size and length of multiple drawdown phases (non-VBA)

    Read post #19.

    Thread closed.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calculate max drawdown in dollar from peak
    By phantomsuisse in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 04:24 AM
  2. [SOLVED] Calculate maximum drawdown with negative numbers
    By billj in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2013, 10:28 AM
  3. Cannot calculate opposite of Drawdown
    By sajeel in forum Excel General
    Replies: 0
    Last Post: 02-28-2013, 12:59 PM
  4. [SOLVED] drawdown
    By pschaff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM
  5. drawdown
    By pschaff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-25-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1