Thanks
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
Check for open trades
Collapse
X
-
Hello matt_,
Thank you for your post.
You would need to check the position of the account. While this is unsupported in NinjaTrader 7 you can use the following code to check the positions on the account:
Code:foreach (Account acct in Cbi.Globals.Accounts) { if (acct.Positions != null) { PositionCollection positions = acct.Positions; foreach (Position pos in positions) { Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice); } }
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Skifree, Yesterday, 01:33 PM
|
6 responses
50 views
0 likes
|
Last Post
![]()
by Skifree
Today, 10:45 PM
|
||
Started by MJ123, Today, 04:06 PM
|
2 responses
15 views
0 likes
|
Last Post
![]()
by MJ123
Today, 09:46 PM
|
||
Started by dgutz15, 12-12-2022, 11:50 PM
|
4 responses
63 views
0 likes
|
Last Post
![]()
by drsclaud23
Today, 08:50 PM
|
||
Started by xtremel, Today, 08:48 PM
|
0 responses
14 views
0 likes
|
Last Post
![]()
by xtremel
Today, 08:48 PM
|
||
Started by SilverSurfer1, Today, 08:27 PM
|
0 responses
5 views
0 likes
|
Last Post
![]() |
Comment