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 judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X