Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding Overfills

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

    Understanding Overfills

    Hi,

    I'd like to understand a bit more about overfills.

    I've seen my strategy produce an overfill, then continue to run. I've also seen my strategy produce an overfill and shut itself down.

    Under what conditions does NT shut down the strategy and what conditions will it keep running; in an overfill situation?

    Also, in the case where the strategy kept running, I noticed that the overfill position had associated with it a stop loss order (from SetStop) that seemed to function correctly. Should I expect this? Is NT designed to have a stop loss on an overfill (meaning if the overfill was from an order that originally had an associated SetStop does NT attach that stop)? Any documentation you can point me to which goes into detail on these sort of issues?

    Finally, if overfilled, and the strategy is still running; what type of manual intervention can I take to reduce position size without upsetting the strategy (including the SetTarget and SetStop orders for the correct part of the position) such that if I close the overfill portion, the balance of the position will exit according the Set rules. Or, must I disable the strategy, close the position, then re-enable?

    Thanks much for your great help!

    #2
    Hi coolmoss,

    Overfills in NT are flagged when an order is marked for cancellation but it's filled before it can be cancelled. These are the only situations where NT marks an overfill but there are race conditions possible where you get a position larger than intended, but it's not marked as overfill.

    This type of situation usually happens when submitting ExitShort() and EnterLong() at the same time. (Reverse for short entries) They're both filled at the same time but NT won't necessarily submit a cancel order for these and then there won't be an overfill raised. NT catches overfills when possible but some items falls on the responsibility of strategy developer to design properly.

    It's good and expected to see your stop loss protects these types of positions. They're triggered on the strategies entry order execution only.

    In a managed strategy, overfills will always disable the strategy. Only in an unmanaged strategy can you set IgnoreOverfill and then code your own handling.

    You can use any order entry window to place opposing orders to reduce the position. The main thing is not to left click the "close" button, as this closes all positions and disables all strategies matching the account /instrument combination.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      The help literature is not very clear about what NT actually does when it detects an overfill. It is implied thet the strat is shut down unless you have IgnoreOverfills = true and are using unmanaged orders, but is that all?
      I am using managed orders, when the strat is shut down, does NT close open positions? Does it cancel any other orders that the strat has submitted? In short, would it leave my account flat and clean?
      Lastly, when this happens, is OnTermination() called?

      Thanks
      Dave

      Comment


        #4
        Hi Dave, the default error handling would the kick into gear - it would attempt to close positions and orders. The script will be disabled so OnTermination() would be called.

        Comment


          #5
          Dave,

          I can report to you that Ninja does a really good job in handling these situations. While there is no absolute guarantee of closing positions and canceling orders (as per the documentation) I have found 100% of the time that in overfill situations Ninja flattens the strategy correctly and cancels any resting orders, then it disables the strategy.

          Comment


            #6
            Thanks both for the help.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X