Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Flatten Everything Event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Flatten Everything Event

    Is there any way to capture the FlattenEverything event?

    Thanks!

    #2
    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>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X