Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit order and multiples entries.

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

    Exit order and multiples entries.

    Hi,

    I have created a strategy which open positions based on two different signals (it can acumulate 2 positions at the same time).

    I am trying to close both positions using only an exit order when a specific condition is true. In order to do it I write nothing in the blank “from entry signal” of the order. However it does not work. The strategy this way closes one position on one bar and the other position on a different bar if the condition has been true.

    In order to solve that I need to create two exit orders, one for each entry signal, and I have to link each exit order to each entry signal using the “from entry signal” option.

    My question is: Is there any way of using just one exit order to close both positions at the same time?

    Thank you in advance.

    #2
    Hello Plaket,

    Thanks for opening the thread.

    If you use the overload for ExitLong() or ExitShort() that does not include a fromEntrySignal, the exit method should exit all open positions in that direction.

    In the demo below, I enter long with 2 different entries and exit my positions with a single call to ExitLong().

    Demo: https://www.screencast.com/t/i4uyntc2

    Please let me know if this information does not resolve your inquiry.

    Comment


      #3
      Thank you Jim,

      Great demostration. I really appreciate the video. Thanks.

      I am creating the strategy using Strategy Builder (Not the editor). I have created a simple strategy that reproduces the issue that I am describing.

      Attach you'll find a screenshot of the code generated (by Strategy Builder) + a screenshot of the problem on a bar chart when I try to run it.

      Perhaps, it is not possible using just an order thru Strategy Builder?

      Thank you again for your great support.
      Attached Files

      Comment


        #4
        Hello Plaket,

        Thanks for that detail.

        You are currently telling ExitLong() to exit with the DefaultQuantity, so it will only exit that number of contracts when the method is called.

        If you use "Strategy \ Current position size" for the Quantity of the exit, your strategy should exit all of the contracts in your current position. This will display as Position.Quantity once added.

        Please let me know if this does not resolve your inquiry.

        Comment


          #5
          Thank you again Jim. Everything is fixed that way.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          80 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          40 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X