In NT7 if you have sync account position set to true it will automatically try and map back existing orders on your account to your strategy. Only exact matches will be mapped back. Orders that cannot be mapped back will be canceled.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
how to programatically close all orders in position
Collapse
X
-
When you shutdown NT and start up again there is no "finding" old orders. NT6.5 begins the strategy completely over again from scratch with no knowledge of any prior orders. There is no way to map orders back.
In NT7 if you have sync account position set to true it will automatically try and map back existing orders on your account to your strategy. Only exact matches will be mapped back. Orders that cannot be mapped back will be canceled.Josh P.NinjaTrader Customer Service
-
Thanks, good to know about that feature. What is the exact syntax in the code to sync account in Initialize method?
So basically, it is safe to assume that in NT7 there will be no orphaned orders related to specific strategy once NinjaTrader starts? And I can check each of the previously saved iOrder objects to verify that they are not NULL? If NULL - that would mean that this order no longer active... Is it correct statement?
Comment
-
You can enabled the autoSync on startup of the strategy via SyncAccountPosition = true; in the strategy Initialize().
If you restart the strategy, it would recalculate and try to remap - however there's no guarantee it can do so, therefore you would need to add checks and potentially account for this in your code if needed. You will need to nullify your IOrder objects as needed, for example reset the targetOrder one to null once the target reached filled / cancelled state etc.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
60 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
147 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
161 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
97 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
284 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment