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!
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
NinjaTrader
account data
Collapse
X
-
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 executedTags: None
-
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
-
Originally posted by franatas View Posttotal pnl made on the day and account balance
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));
Code:// Evaluates to see if the account has more than $25000 if (Account.Get(AccountItem.CashValue, Currency.UsDollar) > 25000) { // Do something; }
Emily C.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by AaronKoRn, Today, 09:49 PM
|
0 responses
11 views
0 likes
|
Last Post
by AaronKoRn
Today, 09:49 PM
|
||
Started by carnitron, Today, 08:42 PM
|
0 responses
10 views
0 likes
|
Last Post
by carnitron
Today, 08:42 PM
|
||
Started by strategist007, Today, 07:51 PM
|
0 responses
11 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,980 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
9 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
Comment