Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Account Values

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

    Account Values

    I try to retrieve account values within strategy but they allways return 0

    this is my code

    AccountItem[] items = {
    AccountItem.BuyingPower,
    AccountItem.CashValue,
    AccountItem.ExcessEquity,
    AccountItem.InitialMargin,
    AccountItem.InitialMarginOvernight,
    AccountItem.MaintenanceMargin,
    AccountItem.MaintenanceMarginOvernight,
    AccountItem.NetLiquidation,
    AccountItem.NetLiquidationByCurrency,
    AccountItem.RealizedProfitLoss,
    AccountItem.TotalCashBalance };

    Print( string.Format("AccountValues {0}", Account.Name) );
    foreach( AccountItem ai in items )
    Print( string.Format("AccountItem.{0}\t\t{1}", ai, GetAccountValue( ai )) );

    this is output

    **NT** Enabling NinjaScript strategy 'AccountValues/040e0af0a69144d48879e0cc46cf6980' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
    AccountValues xxxxxxxx!RCG!RC_Futures
    AccountItem.BuyingPower 0
    AccountItem.CashValue 0
    AccountItem.ExcessEquity 0
    AccountItem.InitialMargin 0
    AccountItem.InitialMarginOvernight 0
    AccountItem.MaintenanceMargin 0
    AccountItem.MaintenanceMarginOvernight 0
    AccountItem.NetLiquidation 0
    AccountItem.NetLiquidationByCurrency 0
    AccountItem.RealizedProfitLoss 0
    AccountItem.TotalCashBalance 0

    #2
    Klaus, would this be for a realtime bar or historical? Historically we would expect them to be 0.

    Comment


      #3
      Bertrand, thanks it works on live data

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      66 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      149 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      99 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      286 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X