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 Carolscogginsi, Yesterday, 10:45 PM
            0 responses
            5 views
            0 likes
            Last Post Carolscogginsi  
            Started by RaddiFX, Yesterday, 10:15 AM
            2 responses
            15 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by patrickmlee007, Yesterday, 09:33 AM
            2 responses
            18 views
            0 likes
            Last Post patrickmlee007  
            Started by magnatauren, 08-15-2020, 02:12 PM
            5 responses
            208 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by rene69851, 05-02-2024, 03:25 PM
            1 response
            23 views
            0 likes
            Last Post rene69851  
            Working...
            X