Max Drawdown code

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #9450 quote
    grizzly
    Participant
    Average

    Hi everyone,

    Could anyone help me refine the code that will return the Drawdown and Run up value ?

    I think Drawdown will be something like this (1min TF over a 1 week lookback):

     

    floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofit
    Drawdown = highest[60*24*7](floatingprofit) - lowest[60*24*7](floatingprofit)
    
    

     

    E.g. I want to refer or closely calculate these values:

    [attachment file=9451]

    Screen-Shot-2016-06-16-at-11.00.00-PM.png Screen-Shot-2016-06-16-at-11.00.00-PM.png Screen-Shot-2016-06-16-at-11.17.05-PM.png Screen-Shot-2016-06-16-at-11.17.05-PM.png
    #9455 quote
    Nicolas
    Keymaster
    Master

    Hi grizzly, drawdown of closed trades or drawdown of the floating ones? There are 2 different things 🙂

    I assume you want to calculate the floating one since you are using the “floatingprofit” variable already discussed here and there on the site, so be aware that the “max drawdown” of the ProBacktest result window has nothing to deal with it.

    grizzly thanked this post
    #9457 quote
    grizzly
    Participant
    Average

    Hi Nicholas,

    I would like the drawdown value of the floating-profit as I’m having trouble with the Max(floating profit) part of the code.

    Thank you

    E.g. Calculate the drawdown in this

    [attachment file=9458]

    high-water-example.png high-water-example.png
    #9471 quote
    Nicolas
    Keymaster
    Master

    So you are looking for the MAE, the Max Adverse Execution, it is the minimum profit that the trade has reached, you should look at my recent blog article about the MFE, it is the exact inverted calculation.

    grizzly thanked this post
    #9474 quote
    grizzly
    Participant
    Average

    Thanks Nicholas – I will take a look

    #9476 quote
    Nicolas
    Keymaster
    Master

    But use the floating profit and not the candlestick close price of course 🙂

    grizzly thanked this post
    #9484 quote
    grizzly
    Participant
    Average

    😉

     

    MAXPRICE = MAX(MAXPRICE,((((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofit))
    graph maxprice coloured (200,0,0) as "c1"
    

     

    [attachment file=”9485″]

    Screen-Shot-2016-06-17-at-7.47.42-PM.png Screen-Shot-2016-06-17-at-7.47.42-PM.png
    #9489 quote
    grizzly
    Participant
    Average

    Perfect for high-watermarks 🙂

    [attachment file=9490]

    Screen-Shot-2016-06-17-at-8.13.52-PM.png Screen-Shot-2016-06-17-at-8.13.52-PM.png
    #9566 quote
    Nicolas
    Keymaster
    Master

    Well done! and seems a nice decent strategy 😉

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Max Drawdown code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
grizzly @grizzly09 Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by Nicolas
9 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/16/2016
Status: Active
Attachments: 5 files
Logo Logo
Loading...