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:
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 {}
}
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

Comment