Thanks!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Flatten Everything Event
Collapse
X
-
Hello Rudmax,
Thank you for your post.
FlattenEverything() is an undocumented/unsupported method. When calling FlattenEverything() we are able to see positions close but we are unable to differentiate between the closed positions because the order name is not unique and only returns "Close".
With that being said, you could subscribe to account-level OrderUpdate events to monitor orders sent to an account. When we create our own order, we can give it a unique name that we can identify in the account's OrderUpdate event. A custom method could be created that loops through your account Positions and checks if that position is Long or Short followed by submitting an order in the opposite direction of the position to close it. For example, if we are in a long position, a sell order will be placed in order to close out that long position.
Please see the attached example strategy which demonstrates how a custom method may be used to flatten all positions on an account.
Also, I have linked the following help guide pages for more information.
OrderUpdate - https://ninjatrader.com/support/help...rderupdate.htm
CreateOrder - https://ninjatrader.com/support/help...tegycreate.htm
Account Positions - https://ninjatrader.com/support/help...ns_account.htm
Let us know if we may further assist.Attached Files<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
93 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
138 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
123 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
73 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment