Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple PB-First fill cancels the rest until next candle

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

    Multiple PB-First fill cancels the rest until next candle


    I have seen this problem earlier in the forum and understand how to keep the order alive. But I am seeing this behavior inconsistent now.

    I have multiple Profit Booking Orders Created (Qty 1 each) along with one single SL Order (Qty 5)

    Issue: On execution of first PB Order, everything gets cancelled immediately (remaining 4 PB order and the one SL order). And these get re-created on the start of the next candle. Problem with this is that multiple PBs do not get filled in one candle and also between this period my open position is unattended.

    But then this does not happen all the time, sometime 1 PB cancels the other 4. But later 3PB doesn't cancel the remaining 2 (this is what I want).
    The next time 1PB also doesn't cancel the other 4. But 4th fill cancels the 5th open PB order.

    I checked my configuration multiple times. They are all identical. This is done through 5 different sets.
    Here is the image of Do the Following. On the Conditions side, there are few common conditions. Then varying PositionQty as listed below.

    I understand the part that Condition when becoming false, immediately cancels the other order. So PB1 execution invalidates the (Qty=5 condition) and that cancels the other open 4? But this doesn't happen all the time.

    Any other suggested solution please ? I do not want the other orders to be "cancelled and recreated on the start of next candle".

    Attached Files

    #2
    Hello pankaj_future,

    Are you separating the entries and orders? For example if you have 5 quantity orders, did you enter 5 separate entries to match those targets?
    Last edited by NinjaTrader_Jesse; 04-11-2025, 07:20 AM.

    Comment


      #3
      No, currently it is one single order with 5 Qty.

      I tried doing 5 different Entry Orders with different names, hoping that would solve this problem.
      But orders were not getting placed, I tried setting "Entries Per Direction" = 5 and "Error Handling" = "Unique Entries" it did not help so I gave up.

      Can you suggest the right settings to able to place 5 exactly identical orders in the same set ? may be I will try it again.

      Comment


        #4
        Originally posted by pankaj_future View Post
        I have seen this problem earlier in the forum and understand how to keep the order alive. But I am seeing this behavior inconsistent now.

        I have multiple Profit Booking Orders Created (Qty 1 each) along with one single SL Order (Qty 5)

        Issue: On execution of first PB Order, everything gets cancelled immediately (remaining 4 PB order and the one SL order). And these get re-created on the start of the next candle. Problem with this is that multiple PBs do not get filled in one candle and also between this period my open position is unattended.

        But then this does not happen all the time, sometime 1 PB cancels the other 4. But later 3PB doesn't cancel the remaining 2 (this is what I want).
        The next time 1PB also doesn't cancel the other 4. But 4th fill cancels the 5th open PB order.

        I checked my configuration multiple times. They are all identical. This is done through 5 different sets.
        Here is the image of Do the Following. On the Conditions side, there are few common conditions. Then varying PositionQty as listed below.

        I understand the part that Condition when becoming false, immediately cancels the other order. So PB1 execution invalidates the (Qty=5 condition) and that cancels the other open 4? But this doesn't happen all the time.

        Any other suggested solution please ? I do not want the other orders to be "cancelled and recreated on the start of next candle".
        I had some kind of the same issue in this post: https://forum.ninjatrader.com/forum/...ss-not-working
        It might have to do the way that you try to exit the positions. My issue was with limit entry orders that State.partfilled v.s. filled created issues.

        Moving my logic to the on execution method and based on that place me stop quantity and exits solved it.

        Kind regards, Jelle

        P.S. If you have methods to cancel or place orders yourself that can happen in the barUpadate and OnExecution, make sure to use the lock(){} method for shared resources since this is done async. Meaning if they execute at the same time they can cancel each other or place multiple orders.
        Last edited by mw_futures; 04-11-2025, 01:54 AM.

        Comment


          #5
          Hello pankaj_future,

          You should be able to place 5 entries with unique signal names and have targets associated with each position so you can scale out of that position later. When using a single entry with multiple targets that will usually cause issues when any type of scaling out happens with exit orders. You can find a simple example that uses multiple entries and targets here: https://developer.ninjatrader.com/do..._of_a_position

          Comment


            #6
            Does this zip have an example on Strategy builder ? what is the name of the Strategy, I imported but could not find any Strategy with this name.

            Thanks for your suggestion mw_futures. I am using Strategy Builder, I guess your solution is with the coding way. ?

            Comment


              #7
              Hello pankaj_future,

              There is not a builder example of that concept that I am aware of however there is really only 1 concept shown in that sample which is submtting two entries. The entries are named

              EnterLong("Long 1a");
              EnterLong("Long 1b");​

              And the targets reference each entry by name so the target applies to a part of the position. You can do the same in the builder by using the signal names. The only other change in that file is EntryHandling = EntryHandling.UniqueEntries;, because two different named orders are used they can both be submitted.

              Comment


                #8
                Thank you, I retried that again. And yes I am able to create multiple same entries, each individually tracked using ErrorHandling = "UniqueEntries".
                It was kind of working fine as long as I had only PB orders (5 named entries + 5 connected PB).
                It started to result in 'open virtual positions when enabled' situation I included 5 SL orders as well. May be having so many orders seems to be complicating the things.

                And I have asked handling of those virtual positions in this forum.


                thanks for very responsive support from you and team!

                Comment


                  #9
                  Hello pankaj_future,

                  That may be how you coded it, do you have an example of what you created?

                  Comment


                    #10
                    Hi Jesse,
                    So I had built it in the strategy builder and not coded. But I got the solution to deal with those Virtual position in the thread I mentioned. But using "State=State.Realtime" in the condition

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    25 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    121 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    64 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    41 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X