I'm developing a custom AddOn for risk management (NinjaTrader 8.1.3.1) and need to programmatically retrieve the account balance at the start of the trading day for display purposes in a custom window (specifically to show absolute balance levels for a trailing drawdown threshold).
Based on the documentation for AccountItem, I've tried using AccountItem.SodCashValue
// Inside a method that has access to the Account object Account account = ... // Get the relevant account object double startOfDayBalance = account.Get(AccountItem.SodCashValue, Currency.UsDollar); // Log the value...
Log: 2025-04-14 11:25:00.724 [Info ] StatusWindow account selection changed to: Sim101 2025-04-14 11:25:00.725 [Info ] startOfDayBalance: 0
However, I'm consistently finding that this call returns a value of 0.
I have tested this thoroughly in the following environments:
- Playback Connection: Using downloaded Market Replay data (e.g., for NQ 06-25).
- Simulated Data Feed: Connected to the default "Sim101" account.
- Live Account Connection: Using my own live brokerage account connection.
In all three scenarios, querying AccountItem.SodCashValue resulted in 0, even after the market had been open for some time (tested on Monday morning local time, which is Sunday evening US market open).
My questions are:
- Is AccountItem.SodCashValue expected to return a non-zero, accurate starting balance value when using the Playback connection or the standard Simulated Data Feed?
- Does SodCashValue depend on specific data providers or broker connections (e.g., older forum posts mentioned it might primarily work with CQG)? If so, which connections currently support it reliably?
- Is there a specific timing aspect (e.g., does it only populate after the broker's official settlement time is passed and data is pushed)?
- Is there any other recommended API method within NinjaScript to reliably obtain the official, broker-reported start-of-day account balance (Cash Value or Net Liquidation) that works consistently across Live, Sim, and Playback connections?
My goal is to display the actual balance level corresponding to risk thresholds, but this relies on getting an accurate starting balance. The alternative is calculating and storing it manually when my AddOn detects a session rollover, but I wanted to confirm if there's an official API value I should be using first.
Thanks for any insights or guidance!

Comment