Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Account Value as a Variable

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

    Setting Account Value as a Variable

    I am trying to pull my trading account value for my trading bot to use as a variable. However, I keep getting a CS0103 error where it says the "GetAccountValue" does not exist in its current context.
    Here is my code:

    private double availableCapital = GetAccountValue(AccountItem.BuyingPower); // Available capital for trading
    private double allocatedCapital = availableCapital; // Allocated capital for the purchased stocksvalue)

    Thanks for any help you can provide.​

    #2
    Hello WolfTrader9,

    Thank you for your post and welcome to the NinjaTrader forum community!

    GetAccountValue() is a method that was available in NinjaTrader 7, though it has changed for NinjaTrader 8. In NinjaTrader 8 you could use Account.Get() to achieve the same goal. For more details, please see the following page:


    This could look like the following in your case:
    Code:
    private double availableCapital = Account.Get(AccountItem.BuyingPower, Currency.UsDollar);
    For additional information about this and other code breaking changes between NinjaTrader 7 and NinjaTrader 8, please review this section of the help guide:


    Please let us know if we may be of further assistance.

    Comment


      #3
      Thanks for the help, Emily.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      129 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      74 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      116 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      111 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      89 views
      0 likes
      Last Post CarlTrading  
      Working...
      X