Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetAccountValue

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

    GetAccountValue

    Hi,

    I'm using this instruction in a ninjascript but it only works in Initialize()

    Print(GetAccountValue(AccountItem.BuyingPower) + "---" + GetAccountValue(AccountItem.CashValue));

    It's possible to make it work in OnBarUpdate()?

    This instruction is retrieving 0 values for BuyingPower and CashValue. At present the values dislplayed in my account (Sim101) are negative. Is this ok?

    thanks

    #2
    guillembm, what would you see if you made the same prints from the OnBarUpdate() instead? It would return 0 for historical bars that would be expected.

    Comment


      #3
      I see what you mean. For an historical bar there is no account info.

      thanks

      Comment


        #4
        Does anyone have a working example of this? I am foreach looping through all Sim101, Sim102 and Sim103 accounts and trying to Print acct.GetAccountValue(AccountItem.BuyingPower, Currency.UsDollar); and all I get is 0. This is on simulated data feed with CalculateOnBarClose = false. I'm doing this code in OnBarUpdate in an Indicator.
        lawyse
        NinjaTrader Ecosystem Vendor - Affordable Indicators

        Comment


          #5
          Hello,

          You do not specify is this in historical bars or live bars? Expected to get this 0 value on historical bars.

          -Brett
          BrettNinjaTrader Product Management

          Comment


            #6
            It's being done on a live bar, ie if (!Historical). Any other ideas? Is it possible to get these values in an indicator, not strategy?
            lawyse
            NinjaTrader Ecosystem Vendor - Affordable Indicators

            Comment


              #7
              Hello,

              Right would need to be in a strategy for sure. In an indicator order methods do not function as well as account performance.

              -Brett
              BrettNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Mindset, 04-21-2026, 06:46 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              144 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              70 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by cmoran13, 04-16-2026, 01:02 PM
              0 responses
              125 views
              0 likes
              Last Post cmoran13  
              Started by PaulMohn, 04-10-2026, 11:11 AM
              0 responses
              78 views
              0 likes
              Last Post PaulMohn  
              Working...
              X