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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
71 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
39 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
63 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment