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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        71 views
        0 likes
        Last Post PaulMohn  
        Working...
        X