Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to access AccountItem information

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

    How to access AccountItem information

    I have tried accessing the Account.GetAccountItem in all workflow events during the OnStateChange event and it always reports back ***** for my values. Be that Sim101, my created simulation account or my actual live account using NT Continuum. Can someone please advice where I can access the present data so I may access these values before beginning my trade logic?

    I also tried in OnBarUpdate but it is also *****. Is it not possible to get this data except in OnAccountItemUpdate? and if so, how do I initial that event on start.

    Code:
    CheckAccount: CashValue:account='MarketAlly LLC!Mirus!M9367' accountItem=CashValue currency=UsDollar value=*****
    CheckAccount: GrossRealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    CheckAccount: Commissionaccount='MarketAlly LLC!Mirus!M9367' accountItem=Commission currency=UsDollar value=*****
    CheckAccount: TotalCashBalanceaccount='MarketAlly LLC!Mirus!M9367' accountItem=TotalCashBalance currency=UsDollar value=*****
    CheckAccount: BuyingPoweraccount='MarketAlly LLC!Mirus!M9367' accountItem=BuyingPower currency=UsDollar value=*****
    CheckAccount: InitialMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=InitialMargin currency=UsDollar value=*****
    CheckAccount: IntradayMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=IntradayMargin currency=UsDollar value=*****
    CheckAccount: RealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=RealizedProfitLoss currency=UsDollar value=*****
    OnStateChange: Configure
    CheckAccount: CashValue:account='MarketAlly LLC!Mirus!M9367' accountItem=CashValue currency=UsDollar value=*****
    CheckAccount: GrossRealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    CheckAccount: Commissionaccount='MarketAlly LLC!Mirus!M9367' accountItem=Commission currency=UsDollar value=*****
    CheckAccount: TotalCashBalanceaccount='MarketAlly LLC!Mirus!M9367' accountItem=TotalCashBalance currency=UsDollar value=*****
    CheckAccount: BuyingPoweraccount='MarketAlly LLC!Mirus!M9367' accountItem=BuyingPower currency=UsDollar value=*****
    CheckAccount: InitialMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=InitialMargin currency=UsDollar value=*****
    CheckAccount: IntradayMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=IntradayMargin currency=UsDollar value=*****
    CheckAccount: RealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=RealizedProfitLoss currency=UsDollar value=*****
    OnStateChange: DataLoaded
    CheckAccount: CashValue:account='MarketAlly LLC!Mirus!M9367' accountItem=CashValue currency=UsDollar value=*****
    CheckAccount: GrossRealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    CheckAccount: Commissionaccount='MarketAlly LLC!Mirus!M9367' accountItem=Commission currency=UsDollar value=*****
    CheckAccount: TotalCashBalanceaccount='MarketAlly LLC!Mirus!M9367' accountItem=TotalCashBalance currency=UsDollar value=*****
    CheckAccount: BuyingPoweraccount='MarketAlly LLC!Mirus!M9367' accountItem=BuyingPower currency=UsDollar value=*****
    CheckAccount: InitialMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=InitialMargin currency=UsDollar value=*****
    CheckAccount: IntradayMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=IntradayMargin currency=UsDollar value=*****
    CheckAccount: RealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=RealizedProfitLoss currency=UsDollar value=*****
    OnStateChange: Historical
    CheckAccount: CashValue:account='MarketAlly LLC!Mirus!M9367' accountItem=CashValue currency=UsDollar value=*****
    CheckAccount: GrossRealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    CheckAccount: Commissionaccount='MarketAlly LLC!Mirus!M9367' accountItem=Commission currency=UsDollar value=*****
    CheckAccount: TotalCashBalanceaccount='MarketAlly LLC!Mirus!M9367' accountItem=TotalCashBalance currency=UsDollar value=*****
    CheckAccount: BuyingPoweraccount='MarketAlly LLC!Mirus!M9367' accountItem=BuyingPower currency=UsDollar value=*****
    CheckAccount: InitialMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=InitialMargin currency=UsDollar value=*****
    CheckAccount: IntradayMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=IntradayMargin currency=UsDollar value=*****
    CheckAccount: RealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=RealizedProfitLoss currency=UsDollar value=*****
    OnStateChange: Transition
    CheckAccount: CashValue:account='MarketAlly LLC!Mirus!M9367' accountItem=CashValue currency=UsDollar value=*****
    CheckAccount: GrossRealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=GrossRealizedProfitLoss currency=UsDollar value=*****
    CheckAccount: Commissionaccount='MarketAlly LLC!Mirus!M9367' accountItem=Commission currency=UsDollar value=*****
    CheckAccount: TotalCashBalanceaccount='MarketAlly LLC!Mirus!M9367' accountItem=TotalCashBalance currency=UsDollar value=*****
    CheckAccount: BuyingPoweraccount='MarketAlly LLC!Mirus!M9367' accountItem=BuyingPower currency=UsDollar value=*****
    CheckAccount: InitialMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=InitialMargin currency=UsDollar value=*****
    CheckAccount: IntradayMarginaccount='MarketAlly LLC!Mirus!M9367' accountItem=IntradayMargin currency=UsDollar value=*****
    CheckAccount: RealizedProfitLossaccount='MarketAlly LLC!Mirus!M9367' accountItem=RealizedProfitLoss currency=UsDollar value=*****

    #2
    I will leave the post - but I spaced the .value property on the return object even though I coded it - I was looking at the ToString() value. It would be nice if the ToString() provided the amount for debugging.

    Sorry to bother with this question.

    Comment


      #3
      You will need to access the .Value property of Account.GetAccountItem() in order to access the actual values. The following code works on my end in both State.Configure and State.SetDefaults:

      Code:
      foreach (Account a in Account.Accounts)
                      {
                          if (a.Name == "Sim101")
                          {
                              Print(a.GetAccountItem(AccountItem.BuyingPower, Currency.UsDollar).Value);
                          }
                      }
      Last edited by NinjaTrader_DaveI; 08-25-2015, 08:40 AM.
      Dave I.NinjaTrader Product Management

      Comment


        #4
        I meant I had resolved it. I was looking at the .ToString() output not the .Value output - which always shows **** instead of the number.

        GetAccountItem(AccountItem.BuyingPower, Currency.UsDollar).ToString()

        vs

        GetAccountItem(AccountItem.BuyingPower, Currency.UsDollar).Value

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, Yesterday, 10:06 AM
        0 responses
        17 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        16 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        14 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        9 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        38 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X