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 CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        27 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        26 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-25-2026, 09:53 PM
        0 responses
        30 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 03-25-2026, 09:51 PM
        0 responses
        18 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 03-23-2026, 11:13 AM
        0 responses
        29 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X