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

Get Total PLN

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

    Get Total PLN

    Friends, I am scratching my head. I know that if you have your settings correct, NinjaTrader 8, does a real decent job of keeping you abreast of your running totals, of unrealized PNL, realized PNL, minus commission for your trades. My question is by passing the Strategy Wizard, and direct coding, I am seeking the input to use in the get() method to create a variables, using the output, contained in the account data tabs. In other words, I would rather go over the mountain, using your calculations , than going around it by rewriting, what you Guys, have already done. Besides I think you guys are pretty good code writers.

    #2
    Hello JLSwin,

    Thanks for your post.

    To pull the account PNL in a strategy you can use: Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar)

    Here is a link to the list of all items you can pull: https://ninjatrader.com/support/help...ccountitem.htm

    Here is a simple example:

    Print ("Account pnl = "+ Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar));
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick reply,
      You must think highly of me having the Guru himself responding. Your response leads me to another question, if I was to run this in onAccountupdate, where in the pecking order should it be placed, before onBarupdate or after.
      Thanks in advance for your response.
      John

      Comment


        #4
        Hello JLSwin,

        Thanks for your reply.

        Using the code I referenced in Post#2 you would not need anything else and that code can be run in OnBarUpdate().

        There is no OnAccountUpdate() so I think you are meaning OnAccountItemUpdate()? If so the OnAccountItemUpdate() code wise can be placed before or after OnBarUpdate().

        References:



        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Does the AccountItem.Realized PnL have the Commission deducted already in it's calculation, or is that something we need to code in.

          Comment


            #6
            Hello JLSwin,

            Thanks for your reply.

            If you have your account set up with a commission template, the account item RealizedProfitLoss will be equal to the account item GrossRealizedProfitLoss - accountitem commission value.

            So yes, that would have commissions included.

            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            8 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X