Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Max drawdown explanation nt8

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Max drawdown explanation nt8

    Hi, i have a strategy which give me as higher maximum drawdown 0.14, what does this means? if i use a 1 : 100 leverage, would i lose all my money in that day (0.14 * 100)? (daily net profit is always positive)

    sorry for stupid question

    #2
    Thank you for your question. Not only is it not stupid but it gives us a chance to explain in greater depth a topic that other customers may be searching the forums for answers on. Please don't hesitate if there is anything we can answer about the way NinjaTrader works. It is thanks to customers like you that we are able to offer the level of support we offer.

    The statistics definition page contains information on several statistics, including maximum drawdown
    Originally posted by http://ninjatrader.com/support/helpGuides/nt8/en-us/statistics_definitions.htm
    Maximum Drawdown

    The maximum drawdown statistic provides you with information regarding the biggest decrease (drawdown) in account size experienced from the highest high seen. Drawdown is often used as an indicator of risk.

    Drawdown=localmaximumrealizedprofit–localminimumrealizedloss
    MaxDrawdown=singlelargestDrawdown

    As an example, your account rises from $25,000 to $50,000. It then subsequently drops to $40,000 but rises again to $60,000. The drawdown in this case would be $10,000 or -20%. Take note that drawdown does not necessarily have to correspond with a loss in your original account principal.

    Note: This statistic may also display in selected Display Units (percent, points, pips or ticks). To see the base calculation behind each execution, view the Profit and Loss Calculation Modes page.


    Another terrific resource is the publicly available page Investopedia, which has this to say


    Originally posted by http://www.investopedia.com/terms/m/maximum-drawdown-mdd.asp

    What is a 'Maximum Drawdown (MDD)'

    A maximum drawdown (MDD) is the maximum loss from a peak to a trough of a portfolio, before a new peak is attained. Maximum Drawdown (MDD) is an indicator of downside risk over a specified time period. It can be used both as a stand-alone measure or as an input into other metrics such as "Return over Maximum Drawdown" and Calmar Ratio. Maximum Drawdown is expressed in percentage terms and computed as:

    (Trough Value – Peak Value) ÷ Peak Value

    On that page is a more detailed breakdown. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      thanks, but if the max dd in nt8 is 1.0%, means that using a high leverage(1:+100) i would wipe my account? (if position is equal to account size)

      Comment


        #4
        Let's start with the definition and plug in what we know.

        Drawdown=localmaximumrealizedprofit–localminimumre alizedloss
        MaxDrawdown=singlelargestDrawdown

        Let's use "RP" for a Realized Profit and "RL" for a Realized Loss. Let's also assume your account started with $1000,000. We'll call this AS for Account Size. I'll borrow a commonly used notation to use _i to mean "the i'th member of a set". For example, _2 would mean the 2nd member of a set.

        Code:
        0.14 = MAX(RP_i - RL_i)
        This means that the biggest single loss (we'll use "ML", and "MD" for Maximum Drawdown) your strategy experienced was

        Code:
        ML = MD * AS
        ML = 0.14 * 100000
        ML = 14 000
        Since Maximum Drawdown looks at changes in your account, your leverage doesn't come into play, since your leverage is already applied by the time your account changes in value.

        All this said, you will need to confirm with your brokerage that the information they report to you (and thus Ninja) regarding your account size is not a leveraged amount. They will be your best resource regarding questions about your account and the way it is reported generally.
        Last edited by NinjaTrader_JessicaP; 05-19-2017, 09:41 AM.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          What if i get the 1% lose on first day first trade? Using a 1:100 would not i lose all?

          Comment


            #6
            1% of your account balance is $1 000 . Your leverage does not matter since drawdown is factored based on your account balance and not your trades.

            It is possible for you to lose all the money in your account if your maximum drawdown is 1%. For example, if you had :

            • 1 trade in which you lost $1 000, drawdown 1%
            • 99 trades where you lost $999, drawdown 0.999% for each
            • 1 trade where you lost $99, drawdown 0.099%

            Your biggest drawdown would be 1%, and all your trades combined would add up to 100%
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Hello Guys, Thnx for the great explanation, but I see that Drawdown should be (highest high realized profit - lowest UNREALIZED Loss) and this is the MAIN difference, if we have an open trade, and this trade is going down 20% from what was the peak of our account, if it comes back and closed the trade losing only 10%, it doesn't mean that DD is 10%, but in reality it was 20%, we should get a way somehow to record this metric somewhere.

              now how can I know the % or DD that my account reached even before closing the trade ?

              Thanks

              Comment


                #8
                Hello MohammedAmine,

                Thank you for your reply.

                NinjaTrader calculates the total drawdown on trade close as 'maximum realized profit - minimum realized loss'.

                https://ninjatrader.com/support/help...ingMaxDrawdown

                Finding if a trade is the max realized profit for strategy can be done in OnExecutionUpdate after the trade closes. You could do something like the following:

                Code:
                topCurrency = Math.Max(Currency.CumProfit, topCurrency);
                
                bottomCurrency = Math.Min(Currency.CumProfit, bottomCurrency);
                Currency.CumProfit would be the strategy's realized pnl. You could then compare the max/min pnl in OnBarUpdate against Position.GetUnrealizedPnL() during an open trade to assess what the current unrealized drawdown would be.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  Hey Kate,

                  I tried this, and I got few error msgs


                  topCurrency = Math.Max(Currency.CumProfit, topCurrency);

                  bottomCurrency = Math.Min(Currency.CumProfit, bottomCurrency);​

                  Im on NT8

                  Click image for larger version

Name:	image.png
Views:	859
Size:	13.5 KB
ID:	1219615


                  thank you

                  Comment


                    #10
                    Hello MohammedAmine,

                    The code in post 8 is pseudocode just letting you know what type of calculation would be needed, you would have to fill in the blanks there with actual variables/values. That simply explains what means you would need to find a lowest/highest value.

                    You can find the CumProfit in the help guide which has a sample: https://ninjatrader.com/support/help...tsub=cumprofit

                    The other error you are seeing is related to using the GetUnrealizedProfitLoss method incorrectly, there is a sample for that in the help guide as well:



                    The topCurrency and bottomCurrency would be variables you need to create for storing the highest and lowest realized profit/minimum realized loss values you found.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Hello Jesse, Thank you very much

                      as u can see here in my posts Im trying to know the unrealized drawdown from the maximum realized balance that I reached, to the lowest unrealized point that my account reached in any given trade.

                      to do so, I use :

                      Code:
                      topReachedBalance = Math.Max(Account.Get(AccountItem.CashValue, Currency.UsDollar), topReachedBalance);
                      LowestReachedPrice = Math.Min(Account.Get(AccountItem.NetLiquidationByCurrency, Currency.UsDollar), LowestReachedPrice);
                      - the problem is, when I have an open trade and I have -500$ in unrealizedloss for example, the Dashboed shows that in NetLiquidity I have 99 500$ instead of 100 000$, but the variable "LowestReachedPrice" always shows 0 when I print it, I don't know why ?

                      - second problem is that "topReachedBalance" keeps the max value as long as the strategy is running, but if it gets interrupted for any reason, it loses all the values, is there a way to not lose these values ?

                      Thank you

                      Comment


                        #12
                        Hello MohammedAmine,

                        The account items you get would reflect the current values of the account, if you need to set a default you would need to hard code that value instead of getting the active account values.

                        For the lowest price you would need to use a print to better understand why that is 0. If the default value of LowestReachedPrice is 0 then doing a Math.Min between 0 and any other higher value would mean the variable retains its 0 value. You could start that variable at a higher number like 10000000 so that any price is lower and gets set to the variable.

                        The variables would be expected to reset if the strategy is reset. To save the values you could write them to a file and then read them when the script is starting up.

                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Aviram Y, Today, 05:29 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post Aviram Y  
                        Started by quantismo, 04-17-2024, 05:13 PM
                        3 responses
                        25 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by ScottWalsh, 04-16-2024, 04:29 PM
                        7 responses
                        34 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by cls71, Today, 04:45 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post cls71
                        by cls71
                         
                        Started by mjairg, 07-20-2023, 11:57 PM
                        3 responses
                        217 views
                        1 like
                        Last Post PaulMohn  
                        Working...
                        X