Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Internal Order Handling w/ 2 Exit Orders

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

    Internal Order Handling w/ 2 Exit Orders

    Hi, I have a question that is not answered in the "Internal Order Handling Rules..." section of the help guide but probably should be. In my strategy, after a long entry order is filled, a stop is placed using ExitLongStop in the OnExecution method. This is only a protective stop and I will usually exit using ExitLongLimit. So my question is: After my ExitLongLimit order is filled, will the ExitLongStop order be cancelled automatically by the internal order handling or do I have to cancel it using CancelOrder?

    #2
    Hello,

    Thanks for the note.

    Can you send me the code your using to submit this. As it will cancel/not submit is a long position is not open. Unless you are using the live until cancelled overload for ExitLongStop().

    Also, you need to submit these inside of OnBarUpdate(). As if you dont use it in OnBarUpdate() and do not use the live until cancelled overload you would need to resubmit this order on each OnBarUpdate for it to remain submitted and not be cancelled.

    A better method to do this is to use SetStopLoss(). Use the following example to modify it during OnBarUpdate() if you needed to do so.



    When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until




    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks for the links Brett. Those will be helpful if it turns out that I need to use the SetStopLoss method. However, the help guide seems to make it clear that if I used this, I wouldn't be able to submit an ExitLongLimit order while the stop is in place: "Methods that generate orders to exit a position will be ignored if a position is open and an order submitted by a set method (SetStopLoss() for example) is active". Thus, I probably need to do it the way I'm trying to do it. And yes, all of my orders are live until cancelled. So again, after my ExitLongLimit order is filled, will the ExitLongStop order be cancelled automatically by the internal order handling or do I have to cancel it using CancelOrder?

      Comment


        #4
        Hello,

        There cannot be an ExitLong order of any kind without a long position open. It would cancel the order if the long position was closed.
        BrettNinjaTrader Product Management

        Comment


          #5
          Ok perfect, so the internal order handling takes care of it. That's a nice convenience/safety feature. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          666 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          377 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          110 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          575 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          580 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X