Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to enter a Limit Order and auto cancel if not filled by net bar?

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

    How to enter a Limit Order and auto cancel if not filled by net bar?

    Hello,

    How do I enter a limit order such that it will be automatically canceled by the next bar if not filled?

    Thanks,

    Billy


    #2
    Hello, thanks for writing in. This is the default mode of operation for limit orders as long as you do not re-submit the order on every bar. E.g. set the order then make sure it does not get resubmitted on the next OnBarUpdate call. Here is the documentation on the subject, see " Order submission for entry and exit methods - basic operation​":
    https://ninjatrader.com/support/help...nForEntryAndEx itMethodsBasicOperation

    Comment


      #3
      Hello Chris,

      Thank you for the information. How about if the order is partially filled, what will happen to the order? Will NT continue to try to fill the remaining order in the next bar? Or will it continue with just the partially filled order?

      Thanks,

      Billy​

      Comment


        #4
        Hello, thanks for the follow-up. The order will stay and continue to finish the filling process should a partial fill occur.

        Comment


          #5
          Hello Chris,

          I assume you mean it will "continue to finish the filling process" until the next bar arrived? When the next bar arrived, the order will stop at the partially filled quantity? Please confirm.

          Thanks,

          Billy

          Comment


            #6
            Hello, thanks for the follow-up. No, the order will continue to fill until the quantity specified in the original order is completely filled.

            Comment


              #7
              Hello Chris,

              Thanks for the clarification. So if I issue CancelOrder upon the next bar, it will cancel the remaining of the order, and just keep the partially filled order?

              Thanks,

              Billy

              Comment


                #8
                Hello Chris,

                Note that I did not use the isLiveUntilCancelled flag in EnterLongLimit() call, can you confirm the order fill will continue even past the current bar? I thought the default behavior is to not fill past the current car, even if the order was partially filled in the current bar?

                Thanks,

                Billy

                Comment


                  #9
                  Hello, thanks for the follow-up. The order will only be canceled if it never goes out of the Working state. If it goes into the filled or partially filled state the rest of the order will not be canceled should the partial filling process take two bars to complete.

                  Comment


                    #10
                    Hello Chris,

                    I see, so the order fill is valid until I call ExitLong (assume I entered with EnterLongLimit call), is that correct?

                    Thanks,

                    Billy

                    Comment


                      #11
                      Hello, thanks for the follow-up. ExitLong() will only work if the strategy is in an open position. If you have a pending/working limit order open you would need to call CancelOrder(). We have an example of this here:

                      Comment


                        #12
                        Hello Chris,

                        Sorry I did not make it clear, let me try again.

                        If I enter the position with EnterLongLimit(), and it was partially filled during the current bar (now a position is opened, albeit only partially filled), when the next bar come along (still partially filled), and if I ExitLong(), will it then cancel outstanding order and flatten my position?

                        Thanks,

                        Billy

                        Comment


                          #13
                          Hello, thanks for the follow-up. ExitLong() can be called on a partially filled position, but you would need to make sure you attempt to only close the filled portion of the order i.e. execution.Order.Filled in OnExecutionUpdate. ExitLong() will not cancel any orders either. The better route to take for a scenario like this is to use small quantities and multiple orders of that same quantity so that you can cancel orders or close open positions individually.

                          Kind regards,
                          -ChrisL

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by NullPointStrategies, Yesterday, 05:17 AM
                          0 responses
                          62 views
                          0 likes
                          Last Post NullPointStrategies  
                          Started by argusthome, 03-08-2026, 10:06 AM
                          0 responses
                          134 views
                          0 likes
                          Last Post argusthome  
                          Started by NabilKhattabi, 03-06-2026, 11:18 AM
                          0 responses
                          75 views
                          0 likes
                          Last Post NabilKhattabi  
                          Started by Deep42, 03-06-2026, 12:28 AM
                          0 responses
                          45 views
                          0 likes
                          Last Post Deep42
                          by Deep42
                           
                          Started by TheRealMorford, 03-05-2026, 06:15 PM
                          0 responses
                          50 views
                          0 likes
                          Last Post TheRealMorford  
                          Working...
                          X