Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged partial fills on exit orders

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

    Unmanaged partial fills on exit orders

    Hi,

    I am using the unmanaged approach and at times need to close everything and be completely flat.

    Given that it is possible to have partial fills on OCO exit orders I want to be as careful as possible exiting.

    Since the profit orders are limit orders, I am changing the limit price to a price well below the market (for longs) so it will effectively become a market order but still be part of the OCO set.

    Is it safe to use Order.Quantity - Order.Filled as my new quantity to allow for the partial fill situation of the OCO?

    I have already cancelled any unfilled portion of the entry order(s) and would rather not cancel the exit orders and place a market order to get flat; there are too many moving parts with that.

    Also, if there is another way of handling all this, I am open to suggestions even if they cause me to have a D'oh moment.

    Thanks
    Scott

    #2
    Hi Scott,

    I'll look into this and will respond later today.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Scott, as long as you wait for a confirmed cancellation of any still working entry orders you should be ok using the order qty of he PartFilled exit order. You can work in an overfill 'protection' still by monitoring this IOrder properly concurrently in your code. Setting IgnoreOverFill to true lets you handle this completely yourself in code - http://www.ninjatrader.com/support/h...reoverfill.htm
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thanks for getting back to me. The way my code is set up, all this is relatively stateless in that in OnExecution I simply respond to any entry order fill by putting out OCO exit orders - one set per partial fill (which obviously includes a single complete fill).

        For that reason, I wouldn't care about an overfill on an entry order (maybe I should set IgnoreOverFill = true) as the code to put out the exit OCO orders doesn't know or care how many fills are expected. I do not want NinjaTrader to take any action on an entry order overfill.

        What my code is attempting to do is close all outstanding positions - get flat.

        My thought is to simply set the limit price on the profit order below the market (as I mentioned above) but I am still not clear about how to tell how many contracts I am holding.

        My reading of the documentation would be Order.Quantity (original order quantity) - Order.Filled (how many contracts of the total have been filled) would be the correct number. I am not concerned about fills crossing a cancel of a profit or stop loss OCO order unless it somehow conflicts with IgnoreOverFill.

        If I end up with an orphan position (from an overfill on a stop or profit OCO order) I can handle that in my code (or manually for that matter).

        I hope this clarifies what I am looking for.

        Scott

        Comment


          #5
          One question in addition to those above; is it safe to assume any time you have an Order.Filled value larger than Order.Quantity, you have received an overfill?

          Scott

          Comment


            #6
            Hi ScottB,

            It seems like you would want to use order.Filled for the quantity of your exit orders. This will tell you the # of contracts that were filled.

            If you're using order.Quantity - order.Filled, then this is the number of unfilled contracts.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Ryan, that is what I am looking for as these are exit OCO orders. I want to move the unfilled quantity of the profit order(s) down to below the market (for longs) such that the order will fill immediately.

              Because I am using ChangeOrder, I believe I have to have the quantity in addition to the price I want to move the order to.

              Thanks
              Scott

              Comment


                #8
                Correct Scott, you need to supply a limit price and qty to amend the order with the ChangeOrder().
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Thanks Bertrand, I have it all working now. I appreciate all the help.

                  Scott

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ghoul, Today, 06:02 PM
                  3 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  44 views
                  0 likes
                  Last Post jeronymite  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  7 responses
                  20 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  10 responses
                  180 views
                  0 likes
                  Last Post jeronymite  
                  Started by DanielSanMartin, Yesterday, 02:37 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post DanielSanMartin  
                  Working...
                  X