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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
327 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
210 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
196 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
284 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
241 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment