Announcement

Collapse
No announcement yet.

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));

    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:



        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.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X