Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partial entry orders resulting in cancelled stops and targets

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

    Partial entry orders resulting in cancelled stops and targets

    I've labored over this all day and all weekend and can't for the life of me figure out where I've gone wrong. This isn't the strategy that I've been working on. It's a pared down version of the EMA cross over that does the same thing. Namely, it enters a quantity of three and puts profit targets at three places and a stop loss. If all three quantities get filled in the same execution, all is well. The stop is adjusted properly when each target is hit and the order handles are nulled out when the third target is hit. However, if the entry is split into two partial fills, either 1 on the first entry and 2 on the second ( 3 total) or vice versa, then when the first or second target is hit, my stop loss and my profit target are both deleted. Boom. Gone. Just like that and I'm left with an outstanding order with no profit target or stop loss. I've attached a series of screen shots that show what's happening and the strategy where you can reproduce this at will on any instrument. You just need to wait until you get partial fills on the entry and it will do it for you on the targets. It stops you out just fine - it's just the targets that have a problem.

    I tried running this strategy in version 7 but with my luck all I got was all three fills on the entry - it was never split so it didn't do it to me in NT7. So I have no idea if it's the framework or if it's something I'm doing.

    Thanks in advance for any help on this!
    Attached Files
    Last edited by traderpards; 12-19-2016, 10:19 PM.

    #2
    Originally posted by traderpards View Post
    However, if the entry is split into two partial fills, either 1 on the first entry and 2 on the second ( 3 total) or vice versa, then when the first or second target is hit, my stop loss and my profit target are both deleted. Boom. Gone.
    Sounds like you are using Managed mode.

    In NT7, Managed mode does not know how to properly support multiple targets from a single entry. Although it looks like it should be supported, and even works sometimes, Single Entry With Multiple Exits is not supported in Managed mode. I don't think NT8 has changed this limitation.

    Your choices:
    1. Stay in Managed mode: but each target must must have its own entry.
    2. Switch to Unmanaged mode.

    Comment


      #3
      Originally posted by bltdavid View Post
      Although it looks like it should be supported, and even works sometimes, Single Entry With Multiple Exits is not supported in Managed mode.
      I went down the same rathole of discovery.

      In NT7, using managed mode, a single order entry with multiple profit target exits seemed to work well for me, but if I recall, partial filled orders screwed things up.

      My solution: use Unmanaged mode.

      For every Managed mode API method, I made a corresponding method using the syntax,

      SubmitOrder_apiname

      For example, in NT7 I had,

      Code:
              // generate BuyToOpen MARKET order to enter LONG position
              protected IOrder SubmitOrder_EnterLong(int Quantity, string SignalName)
              {
                  IOrder order = null;
      
                  if (Quantity > 0)
                  {
                      if (Unmanaged)
                          order = SubmitOrder(eBIP, BuyToOpen, MARKET, Quantity, 0, 0, "", SignalName);
                      else
                          order = EnterLong(Quantity, SignalName);
                  }
      
                  return order;
              }
      Where eBIP, BuyToOpen, and MARKET were simple constants.

      My desire was: continue to use Managed mode API semantics but do so through a redirection layer, so that I could easily switch to Unmanaged mode later.

      Comment


        #4
        I guess that's a thought - make three separate entry orders and match them up with the profit targets... But if I want 10 or 20 contracts someday when I'm rich and famous... Ugh.

        So you're saying they did things the exact same way in NT8 as they did in NT7? It doesn't seem to me that using the nuclear approach - blowing away all the stops and targets with the same signal name is exactly the best way to handle someone's orders. If that's the way it was in NT7, one would think they would have taken care of that at the design table for the newer and better version, or at least figured out a way to work around it, like making the entry order name available to the user, or at least giving it a different name or some way to do that. It seems to me, I should be able to use managed orders with multiple targets on a single entry.
        Last edited by traderpards; 12-20-2016, 09:38 AM.

        Comment


          #5
          Originally posted by traderpards View Post
          So you're saying they did things the exact same way in NT8 as they did in NT7?
          NinjaTrader support can confirm ...

          Comment


            #6
            Originally posted by bltdavid View Post
            NinjaTrader support can confirm ...
            I wish they would...

            Comment


              #7
              In the meantime, here is a prior comment I found,

              Last edited by bltdavid; 12-20-2016, 12:44 PM.

              Comment


                #8
                Originally posted by bltdavid View Post
                In the meantime, here is a prior comment I found,

                http://ninjatrader.com/support/forum...57&postcount=2
                Also, if you study the managed mode example on scaling out of a position,



                you'll see they have separate entry orders.

                Comment


                  #9
                  Also, forgot to mention, turn on TraceOrders and study the output there, too.

                  But I still think main culprit is managed mode does not support multiple
                  exits from a single order entry ...

                  Try studying Grand Jedi Support Master Bertrand's comments here,



                  EDIT:
                  Btw, in that thread above, Bertrand said this,

                  "With your one entry order and then later scaleout you will be running into issues in managed. You need to scale in first to be able to scale in later, so have 3 unique entries for example if you want to scale out with 3 individual targets later."

                  If you read it carefully, I'm sure he meant scale out, not scale in.
                  Last edited by bltdavid; 12-22-2016, 01:48 AM. Reason: fix mispelled TraceOrders

                  Comment


                    #10
                    Hello,

                    Thank you for your patience.

                    We are exploring this further with development. We will update this when we have further details.

                    Comment


                      #11
                      Originally posted by bltdavid View Post
                      Sounds like you are using Managed mode.

                      In NT7, Managed mode does not know how to properly support multiple targets from a single entry. Although it looks like it should be supported, and even works sometimes, Single Entry With Multiple Exits is not supported in Managed mode. I don't think NT8 has changed this limitation.

                      Your choices:
                      1. Stay in Managed mode: but each target must must have its own entry.
                      2. Switch to Unmanaged mode.
                      Hello bltdavid & traderpards,

                      I am confirming this behavior is the same as NinjaTrader 7. As you quoted from the other thread, you would have to scale in to scale out with Managed approach.

                      Comment


                        #12
                        Workaround

                        Originally posted by NinjaTrader_PatrickH View Post
                        Hello bltdavid & traderpards,

                        I am confirming this behavior is the same as NinjaTrader 7. As you quoted from the other thread, you would have to scale in to scale out with Managed approach.
                        So, I asked myself this question... What if, after Ninja blows away my stops and targets, I simply put them back? I thought of that last week and finally got a chance to see if I could get away with implementing it; that is, is there enough information available and am I able to put a stop and target back without Ninja cancelling those too. So I tried it and it works! After Ninja is finished cancelling everything, you are able to replace them and your orphaned entry is no longer an orphan.

                        I've been running the market replay for the last few hours and it seems to work like a champ without any issues, whether it fills one out of three first or two out of three first.

                        So it would appear there's another option...
                        Attached Files

                        Comment


                          #13
                          Originally posted by traderpards View Post
                          So, I asked myself this question... What if, after Ninja blows away my stops and targets, I simply put them back? I thought of that last week and finally got a chance to see if I could get away with implementing it; that is, is there enough information available and am I able to put a stop and target back without Ninja cancelling those too. So I tried it and it works! After Ninja is finished cancelling everything, you are able to replace them and your orphaned entry is no longer an orphan.

                          I've been running the market replay for the last few hours and it seems to work like a champ without any issues, whether it fills one out of three first or two out of three first.

                          So it would appear there's another option...
                          I think your discovery is lulling you into a sense of complacency that leads only to the dark side.

                          Just because you found a "workaround" that seems to work with your current arrangement of entries and targets and stops, does not mean that all future combinations will do the same.

                          I also went down this road, taking extra care to re-employ the most recent stop and or target if it was canceled during a partial fill, but I found other issues when a target was partially filled and price retreated -- never filling the remainder of the target.

                          Even after thorough testing with a variety of increasing quantities, you will never be sure that some specific sequence of fills and partial fills won't tickle the active order arrangement and somehow one or more of your orders disappear.

                          NinjaTrader support has already told us single entry with multiple scale-out is not well supported under Managed mode, regardless of NT7 or NT8. This alone should scare you away from trusting real money with your workaround.

                          Your workaround is a ticking time bomb -- there is no procedure to defuse it, since none exists. The unknowns are too great, and you have no recourse with Support if any unknown 'unknowns' defeat your workaround.

                          The only correct workaround that can be trusted is to use Unmanaged mode.

                          Comment


                            #14
                            Originally posted by bltdavid View Post
                            The only correct workaround that can be trusted is to use Unmanaged mode.
                            I'm not sure you can truly say that. It might be true in some circumstances but it also might not be true in others. I've certainly proven that for this example it does work. I've run it (in MR) for three simulated weeks and in all scenarios it worked. I don't mind saying I was staring at it, actually expecting that renegade stop or target to turn into an unprotected entry. But even if one of the targets was hit and others weren't, it still ran properly when reversing or getting stopped out for the other two.

                            You're talking about limit orders, which I don't use. I can see how that could lead to trouble, although this workaround should work for that as well, but for market orders, if you code it properly, it will work. Even with unmanaged orders, there are so many rabbit holes you could fall into, I think that's more dangerous for me. But if you code unmanaged properly, then you're fine there as well.

                            No matter what method you use, you still need to put your strategy through rigorous testing before you put real money to it and that doesn't change for managed or unmanaged, workaround or not.

                            Comment


                              #15
                              Originally posted by traderpards View Post
                              I've certainly proven that for this example it does work.
                              But, think carefully, you've essentially proven nothing.

                              Will the next version of NT8 behave the same?
                              You don't know, this is unsupported and undefined behavior.

                              Will the behavior be the same with MR vs Sim101 vs Live?
                              You don't know, since the engineers were never told they had to care about this, there is no guarantee it will work the same. Even different adapters (Continuum vs Rithmic vs IB) could show different behaviors here.

                              Will the behavior be the same if you change your quantities?
                              You don't know, you'll have to repeat all your testing, including MR, Sim101, and live.

                              Why take the risk?
                              Using Unmanaged mode is the correct way to do what you want, and migrating code from Managed to Unmanaged is relatively painless.

                              If you use this strategy to trade real money in a live account, the only thing you have proven is you are willing to take a foolish and completely unnecessary risk with your money.

                              To be carefree about this risk -- which is systemic to how NinjaTrader.exe operates in Managed mode -- is mind boggling.

                              You can eliminate this specific systemic risk by moving to Unmanaged mode.

                              Why would you not do that?

                              Originally posted by traderpards View Post
                              You're talking about limit orders, which I don't use.
                              Your target orders used ExitLongLimit() & ExitShortLimit(), which are limit orders.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Yesterday, 05:17 AM
                              0 responses
                              54 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              130 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              72 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              44 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              49 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X