Is MaxDrawDown

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #232048 quote
    maluna
    Participant
    New

    I don’t know why max drawdown is not correctly calculated in probacktest

    I have the most simplebuy and hold strategy on SPY.

    Buy 1 january 1998 and sell today

    accordingly to the generated result the max drawdown is only 24.5% that it is clearly wrong considering the big downs of years 2000 and 2008

    Any idea why the drawdown is wrong?

    code

    DEFPARAM CumulateOrders = False 
    
    buy (100000/close) shares at market

     

    Thanks in advance!

    Captura2.png Captura2.png Captura.png Captura.png Captura2-1.png Captura2-1.png
    #232055 quote
    JS
    Participant
    Veteran

    Personally, I think a “Drawdown” of 24.5% ($-141,467.75) is a decent “Drawdown”…

    The calculation of the maximum “Drawdown” is always relative to the maximum “Runup”…

    %Drawdown = Max. Drawdown / Max. Runup * 100

    %Drawdown = 141.467,75 / 578.765,00 * 100 = 24,5%

    #232070 quote
    Iván González
    Moderator
    Master
    Hi, In my opinion the DD% is not correctly calcultated. See attached image.
    defparam cumulateorders = false
    capini = 100000
    buy capini/close shares at market
    
    if not onmarket then
    mystrategyprofit=strategyprofit
    elsif longonmarket then
    mystrategyprofit=strategyprofit+(close-tradeprice)/pointsize*pointvalue*countoflongshares
    endif
    
    equitycurve = mystrategyprofit+capini
    
    //Maxrun
    if equitycurve > maxrun then
    maxrun = equitycurve
    else
    maxrun = maxrun
    endif
    //Drawdown
    DD=equitycurve-maxrun
    DDp = DD/maxrun*100
    
    if DDp < maxDDp then
    maxDDp = DDp
    else
    maxDDp = maxDDp
    endif
    
    //graph equitycurve
    //graph maxrun as "maxrun" coloured("blue")
    graph DDp as "DD %" coloured("blue")
    graph maxDDp as "Max DD" coloured("red")
    graph 0 
    SP500-Diario.png SP500-Diario.png
    #232105 quote
    maluna
    Participant
    New
    Hi all, “%Drawdown = 141.467,75 / 578.765,00 * 100 = 24,5%” This is not correct, result is not 24,5%, is 24,42% instead, this is not how this %MaxDD is calculated 24,5% is calculated from the absolute number of drawdown that is -141.467 $ that was a -24,5% at that point in time considering the current balance of the system at that point in time, but this is not the definition of a max drawdown, max drawdown should not consider absolute numbers or be dependant of your balance at that point in time, should work with %’s I agree with Ivan, MaxDD for this strategy should be -56,58% as you can see in Ivan’s attachment. In my opinion this value is not correct at all. Thanks for your answers!
    #233263 quote
    Nicolas
    Keymaster
    Master
    For your information, numerous fixes have been made to this problem, but they are not yet deployed on the IG side, but should be available next week.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Is MaxDrawDown


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
maluna @maluna Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by Nicolas
1 year, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/29/2024
Status: Active
Attachments: 4 files
Logo Logo
Loading...