Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trailing Max Drawdown

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

    Trailing Max Drawdown

    The Accounts window allows to show the Trailing max drawdown.

    Click image for larger version

Name:	image.png
Views:	60
Size:	7.1 KB
ID:	1326989

    How can I access the value of that from the currently selected account in the chart?

    I want to be able to display it on the chart with OnRender.

    I know this
    Code:
            myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101");
    Will get me the Sim account, but how do I get the currently selected account

    Click image for larger version

Name:	image.png
Views:	65
Size:	4.9 KB
ID:	1326988

    Thank you in advance!

    #2
    Hello davydhnz,

    You can use the accounts Get method to get account item values. You can find a list of available options in the page linked below.

    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.

      I went through both pages and couldn't find.



      If it's not 'officially' supported, is there some unofficial code?
      Thank you.

      Originally posted by NinjaTrader_Jesse View Post
      Hello davydhnz,

      You can use the accounts Get method to get account item values. You can find a list of available options in the page linked below.

      Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

      https://developer.ninjatrader.com/do...op/accountitem

      Comment


        #4
        Hello davydhnz,

        While that is currently not documented it may work to use: AccountItem.TrailingMaxDrawdown
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello davydhnz,

          While that is currently not documented it may work to use: AccountItem.TrailingMaxDrawdown
          Well I walked into that one But thanks.

          The only thing I can't work out is how to get the currently selected chart account.
          I can specify the account using

          Code:
          myAccount = Account.All.FirstOrDefault(a => a.Name == "Account34924837");
          But is there a way to automatically get the currently selected account in the chart?

          Click image for larger version

Name:	image.png
Views:	55
Size:	6.4 KB
ID:	1327253

          Comment


            #6
            Hello davydhnz,

            You can see the following sample for a way to do that.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Thank you heaps!

              Comment


                #8
                Last question. You've been very helpful. I've got everything working except one thing.

                Currently I'm using ChartControl.MouseLeftButtonDown as a trigger for when to check the account for an update.
                I don't really want to constantly call dispatcher like the sample code you provided which does it constantly in onbarupdate.

                Is there a ChartControl.something for when you release the mouse on a list. e.g. the list in
                Click image for larger version

Name:	image.png
Views:	47
Size:	6.4 KB
ID:	1327409

                ChartControl.MouseLeftButtonDown doesn't detected this, it only detects if you click where the bars are in the chart.

                Thanks again!​

                Comment


                  #9
                  Hello davydhnz,

                  There would not be a event for just the list inside the left mouse button event, that event will only detect mouse down events but not be specific as to what was clicked. Generally if you are using UI controls you would place your code that uses them inside the dispatcher to get a new value from the ui control before using it. That way all of the code is executed at the same time when the UI thread gives access to allow for the Ui to be used.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by tmk-c, 07-19-2017, 11:29 PM
                  6 responses
                  1,685 views
                  0 likes
                  Last Post Brightredmegaphone  
                  Started by Trader4Life, Today, 09:20 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post Trader4Life  
                  Started by WileCoyote, Today, 08:26 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post WileCoyote  
                  Started by madankumars, 11-18-2019, 11:12 AM
                  10 responses
                  175 views
                  0 likes
                  Last Post ulisesguerrero  
                  Started by rrsch, Today, 10:26 AM
                  2 responses
                  12 views
                  0 likes
                  Last Post rrsch
                  by rrsch
                   
                  Working...
                  X