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 Vitamite, Yesterday, 12:48 PM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by aligator, Today, 02:17 PM
              0 responses
              10 views
              0 likes
              Last Post aligator  
              Started by lorem, 04-25-2024, 09:18 AM
              22 responses
              94 views
              0 likes
              Last Post lorem
              by lorem
               
              Started by sofortune, Today, 10:05 AM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by ETFVoyageur, 05-07-2024, 07:05 PM
              23 responses
              185 views
              0 likes
              Last Post ETFVoyageur  
              Working...
              X