Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current account balance

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

    Current account balance

    How do I obtain the current account balance in my script?

    I've tried "AccountItem.CashValue" but that simply gives the same account balance, regardless of trading activity. I've also tried "Account.AccountStatusUpdate += OnAccountStatusUpdate;" (as per the Help Guide), but those produce compile errors.


    #2
    Hello spottysallrite,

    A NinjaScript Strategy has a position and has profit and loss, but it does not have a separate cash value. That would be an account item.

    If you do want to get the account cash value, using Account.Get(AccountItem.CashValue, Currency.UsDollar) would be correct.


    If you would like assistance with compile errors, please provide the full error message, or a screenshot.

    Do you have an OnAccountStatusUpdate method defined in the script?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I'm not following. Why would I want to have "OnAccountStatusUpdate()" defined in my script? Doesn't "Account.Get(AccountItem.CashValue, Currency.UsDollar)" provide the current balance?

      Comment


        #4
        Hello spottysallrite,

        Because you are calling 'Account.AccountStatusUpdate += OnAccountStatusUpdate;' in your script.

        If you do not have a method called OnAccountStatusUpdate defined, then there will be a compile error as that method name won't exist.

        Yes, Account.Get() will get an account item like the Cash Value. Account.AccountItemUpdate would also update anytime an account item changes.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X