Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing a stop loss order when the entry order had partial fills

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

    Changing a stop loss order when the entry order had partial fills

    Hi,

    I have a situation where I put orders on both sides of the market using the unmanaged approach. I can have a situation where a long signal is generated that is "inside" an existing stop order for a short position.

    When this happens, I need to bring my stop down to match the new entry order. When the original short position was filled, it may be with many partial fills and in OnExecution I submit a pair of OCO orders for the the execution quantity using the same 2 IOrder objects (short stop loss and short profit target).

    If I then need to move all the stop losses down (as per above), does one call to ChangeOrder do this or do I need an array of IOrder objects, each one for the individual partial fills and then loop through the array and call ChangeOrder for each partial fill.

    Is it better/possible to call ChangeOrder in OnExecution and amend a single stop loss order with the new quantity and would that in any way affect the other OCO (profit) order?

    In summary, I can end up with many partial fills resulting in a series of stop loss orders all at the same price which I may then need to move, all to the same price. What is the best way to do this?

    This is essentially the same issue you would have if you wanted to have a trailing stop. From the examples I have seen it appears that partial fills do not figure into a trailing stop scenerio.

    Thanks,
    Scott
    Last edited by ScottB; 08-07-2010, 12:18 PM.

    #2
    Scott, I will have someone respond to you on Monday.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks, I appreciate that. I did see one post that looks like once the entry order is in a "filled" state, you can manage the position as though it was one fill but I am still not sure exactly what the implications of that are.

      Comment


        #4
        ScottB,

        No, if you have multiple stop orders which it sounds like you do, you will need to modify each one individually down. If you only have one pair for the overall position then modifying that single pair will do.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh, Thanks for getting back to me; I need a little more clarification.

          I place my stops and profit orders in OnExecution (which I understand to be the correct place to do this) on each partial fill. These orders are linked as OCO orders using execution.ExecutionId as the OCO name.

          I could have many partial fills but once I have a "filled" state for the entry order; do I treat all the stop and profit orders generated due to the partial fills as separate orders or as one OCO set if I want to move the stop or profit targets?

          If I wanted to have a trailing stop for instance, would I have one stop order effectively or one stop order for each partial fill? The same question on the profit target side. If I want to move my profit target up (in the case of a long entry), can I treat the partial fills as one order?

          All the partial fills of a type (stop or profit) will have the same exit price; under no conditions do I have multiple stop prices or multiple profit target prices.

          I hope this clarifies my question. Thanks for your help.

          Comment


            #6
            ScottB,

            This depends on how exactly you have it programmed in OnExecution(). If in OnExecution() you are submitting individual (new) stop/target pairs for each partial fill then you would need to move every single pair set. If you programmed it to just amend the original pair's quantity as more entry partial fills are received then you would only need to move one set of orders.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I am using unmanaged orders; can you point me to an example of amending the orders so as to have only one set?

              If it is as simple as putting out the first pair with SubmitOrder and then using ChangeOrder to modify the quantity for each side of the OCO, I can do that with no issue.

              However, that approach would bring up another question. If I amend the profit order to reflect the new quantity (additional partial fills) does NinjaTrader have the internal order handling smarts to not lose my place in the queue as I increase the quantity?

              If I change the profit order from 1 to 3 to 8 do I have 3 orders at the exchange (1 lot, 2 lot and 5 lot) each with their proper place in the queue or do I have just one for 8 lots at the end of the queue?

              Thanks

              Comment


                #8
                ScottB,

                Unfortunately there is no reference sample for this. To amend an order instead of sending new ones you would simply be using ChangeOrder() instead of SubmitOrder() when the stop/target IOrders are != null and are not terminal. As long as that condition is true we assume the stop/targets are still active and we can use ChangeOrder() instead of SubmitOrder() for new ones.

                When you are using Unmanaged there is zero internal handling. This is what is meant by unmanaged; you are 100% on your own. If you want to stay in place then just use SubmitOrder() and keep track of all of your various pairs. This is what is nice about unmanaged. You have the flexibility to choose whichever technique you find acceptable.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks Josh,

                  That is pretty much how it would work in any API where you are completely responsible for your own orders and definitely the way I prefer it.

                  If this were market making or a strategy that was only going for 1-2 ticks, the place in queue might matter but not for what I am doing.

                  This is not to mention, once you reach the head of the queue for with your entry, the chances of a partial fill that is later filled completely are pretty small (obviously anything can happen) and so all your partials are likely to be milliseconds apart.

                  Scott

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Barry Milan, Today, 10:35 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by WeyldFalcon, 12-10-2020, 06:48 PM
                  14 responses
                  1,428 views
                  0 likes
                  Last Post Handclap0241  
                  Started by DJ888, Yesterday, 06:09 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  40 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Today, 08:51 AM
                  2 responses
                  16 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X