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 andrewtrades, Today, 04:57 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              6 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              7 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X