There are several functions within NinjaTrader that are based on the current state of your account at the moment the function is invoked. These functions are:
In flight executions are orders that are partially or completely filled between the time that you invoke one of the above functions and the time your connectivity provider acknowledges the order submission/modification/cancellation requests submitted by these functions. Here is an example:
1. You have an open long position for three contracts and several working stop loss and profit target orders for three contracts each
2. You invoke the command "Flatten Everything" which proceeds to cancel all working orders and submit a market order to close the three contract position
3. One of your profit target orders is filled before the cancellation request arrives at the exchange
4. The market order to close the position is also filled for three contracts
5. You now have an open short position for three contracts
This example is generally a rare occurrence. After invoking any of the above commands it is always prudent to check the Control Center's Positions Tab and Orders Tab to ensure that all orders were cancelled and positions flattened. To avoid these situations you should be cautious of using the "Close Position" function when you have orders that are working within a few ticks of the inside market.