Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit order doesn´t run with SetStopLoss

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

    Exit order doesn´t run with SetStopLoss

    Hello,
    I have a simple strategy .
    In this code I put the "SetStopLoss" method inside OnBarUpdate(), just after sending an EnterLong order.
    When the profit is >= 12 ticks above the entry price, I send an ExitLongStopMarket order , but It doesn´t run ,
    because I see that the SetStopLoss() method to exit this long position always cancel the ExitLongStopMarket order.
    How can I do to use this ExitLongStopMarket order together with the protection of the SetStopLoss() method ?
    Attached Files

    #2
    Hello Parmenides48,

    It is not advised to use multiple exits for a single entry. Even if you are wanting to scale out, its necessary to have separate entries with different signal names.

    What you are doing is violating the Internal Order Handling Rules.

    "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"

    https://ninjatrader.com/support/help...antedPositions

    If you are using ExiLongStopMarket(), just use that and don't use SetStopLoss(). These both send the same kind of order anyway.



    Also, you should always call Set methods before placing the order. This is because Set methods cannot be unset and will continue to be set for new orders. If you want to alter the set method, this should be done before the entry fills and the order is already submitted.
    Last edited by NinjaTrader_ChelseaB; 01-21-2019, 11:45 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your fast answer.
      But, how do I do to cancel the SetStopLoss to use the ExiLongStopMarket() order?
      The problem is that when the order to enter is filled, I immediately need protection till the end of that bar !.
      If I write :
      EnterLong();
      ExitLongStopMarket();

      I see that the second order to protect my new Long position ( in this entry bar ) doesn't run ( as if doesn't know my new long position) !!!,
      So, I have to put SetStopLoss() to protect my new long position.
      But in the next bars , If I decide to exit in certain price with an ExitLongStopMarket() order, I can't.

      Then, How do I do to cancel SetStopLoss() and use an ExitLongStopMarket() order ??

      Comment


        #4
        Hello Parmenides48,

        SetStopLoss() orders cannot be cancelled.

        I am suggesting that if you plan to use ExitLongStopMarket() with a specific entry order, don't use SetStopLoss() at all on that entry order.

        You can submit an order the moment the entry order fills in OnExecution() or OnOrderUpdate().

        Below is a link to an example.
        https://ninjatrader.com/support/foru...269#post802269
        Last edited by NinjaTrader_ChelseaB; 01-21-2019, 12:57 PM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks a lot for your answer. I am going to work on it.

          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