Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TD Ameritrade Account info not populated?

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

    TD Ameritrade Account info not populated?

    Hi,

    I have added some code to my strategy to print account information. When I connect to IB the code works, but when I connect to TDA it does not. I need it for may strategy to work properly.

    Any Idea how I can get the account info to populate?

    Thanks,
    Erik

    This is the code:

    Code:
    if (State == State.Configure) {
        try {
            Print("Account Info:");
            foreach (Account Acct in Account.All) {
                if (Acct.Name != "TDA ACCT #" && Acct.Name != "IB ACCT #") continue;
                Print("Account: " + Acct.DisplayName.ToString());
                var enumValues = Enum.GetValues((typeof(AccountItem)));
                foreach (AccountItem enumValue in (AccountItem[])enumValues) {
                    var Name = Enum.GetName(typeof(AccountItem), enumValue);
                    var Value = Acct.GetAccountItem(enumValue, Currency.UsDollar).Value;
                    Print(Name + ": " + Value);
                }
            }
    
        }
        catch {}
    }​​
    The TDA Output:

    Account Info:
    Account: TDA ACCT #
    BuyingPower: 0
    CashValue: 0
    Commission: 0
    ExcessIntradayMargin: 0
    ExcessInitialMargin: 0
    ExcessMaintenanceMargin: 0
    ExcessPositionMargin: 0
    Fee: 0
    GrossRealizedProfitLoss: 0
    InitialMargin: 0
    IntradayMargin: 0
    LongOptionValue: 0
    LookAheadMaintenanceMargin: 0
    LongStockValue: 0
    MaintenanceMargin: 0
    NetLiquidation: 0
    NetLiquidationByCurrency: 0
    PositionMargin: 0
    RealizedProfitLoss: 0
    ShortOptionValue: 0
    ShortStockValue: 0
    SodCashValue: 0
    SodLiquidatingValue: 0
    UnrealizedProfitLoss: 0
    TotalCashBalance: 0


    Enabling NinjaScript strategy 'xxxxxxxxxxx SPY/xxxxxxxxxxxx' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=1 StopTargetHandling=By strategy position ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On bar close IsUnmanaged=False MaxRestarts=4 in 5 minutes

    #2
    Hello ErikHR1969,

    Each data provider offers different account values, TDA offers very few account values compared to other brokers. You can find a list of the values that each broker offers here: https://ninjatrader.com/support/help...counts_tab.htm

    Are you able to see the buying power or cash value showing a value in the control center accounts tab? The NinjaScript output is going to match what you see in the accounts tab for broker provided values.

    Comment


      #3
      Hi Jesse,

      Yes, I can see buying power and cash value.

      Thanks,
      Erik

      Comment


        #4
        Hello ErikHR1969,

        It sounds like its working then, as noted there are not many account values populated with TDA. If you need a reference please see the chart in the help guide for the available values for TDA, unfortunately there is not a way to gather other account values which you may be able to see inside of TDA software.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        39 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        19 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        26 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Working...
        X