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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      22 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      280 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      279 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      130 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X