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.
    BertrandNinjaTrader Customer Service

    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

          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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by maybeimnotrader, Yesterday, 05:46 PM
              2 responses
              21 views
              0 likes
              Last Post maybeimnotrader  
              Started by adeelshahzad, Today, 03:54 AM
              5 responses
              32 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by stafe, 04-15-2024, 08:34 PM
              7 responses
              32 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by merzo, 06-25-2023, 02:19 AM
              10 responses
              823 views
              1 like
              Last Post NinjaTrader_ChristopherJ  
              Started by frankthearm, Today, 09:08 AM
              5 responses
              22 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X