Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
MarketPosition
Collapse
X
-
MarketPosition
Does MarketPosition indicate the strategy's current position or the account's current position? Reason being is I'm trying to setup multiple diversified strategies trading the same instrument and want to create a script to check if I'm already long/short in the instrument with another strategy. And if so the strategy wanting an opposing trade would not take the entry. Thanks.Tags: None
-
Hello dirkdiggler,
The MarketPosition will only be the position of the strategy and will not be the account position.
To find the account position or orders this would need undocumented / unsupported code:
Code:foreach (Account acct in Cbi.Globals.Accounts) { if (acct.Positions != null) { // print information about each position PositionCollection positions = acct.Positions; foreach (Position pos in positions) { Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice); } // print information about each order OrderCollection orders = acct.Orders; foreach (Order ord in orders) { Print(ord.ToString()); } }Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
74 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
45 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
26 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
32 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
62 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment