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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      284 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      177 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      172 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      263 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      216 views
      0 likes
      Last Post CarlTrading  
      Working...
      X