Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

account data

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

    account data

    I don't know if I already asked it but I don't remember it nor do I find it in conversations. Is there a way to call: protected override void OnAccountItemUpdate(Account account, AccountItem accountItem, double value) when starting the strategy before a trade is executed

    #2
    Hello franatas,

    Thank you for your post.

    OnAccountItemUpdate() is an event-driven method, so it is only called when an AccountItem is updated. There is no way to call it manually; you would have to wait for one of the account items to be updated which is why you usually don't see any updates unless a trade is executed.
    Is there a particular value from the account you are looking to obtain before a trade is executed? If that is the case, you may be able to use Account.Get() to obtain the desired AccountItem without having to wait for an AccountItemUpdate event to trigger:


    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      total pnl made on the day and account balance

      Comment


        #4
        Originally posted by franatas View Post
        total pnl made on the day and account balance
        I suggest using the Get() method to obtain those values. The AccountItem values are listed here:


        For example, to get the RealizedProfitLoss (total PnL) you would use Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar) like this example print statement:
        Code:
        // Print out the account's realized PnL:
        Print("RealizedProfitLoss: " + Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar));
        For balance, you may want the CashValue which is shown in the example on the Get() page:
        Code:
        // Evaluates to see if the account has more than $25000
        if (Account.Get(AccountItem.CashValue, Currency.UsDollar) > 25000)
        {
          // Do something;
        }​
        Please feel free to reach out with any additional questions or concerns.
        Emily C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        12 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        10 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        15 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Working...
        X