Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop and reversing a position

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

    Stop and reversing a position

    NT support,

    I am wondering if you could please help me?

    Scenario background:

    I am executing a NT strategy. We would like to Stop and Reverse a position. We are entering and exiting the market using Advanced Managed Orders (e.g. ExitLongStop, etc). I had planned to use a ExitLongStop order, doubling the quantity of the original entry position to create a reversing position of the same size. See example code below:


    Code:
    
    stoporder = ExitShortStop(0, true, (execution.Order.Quantity)*2, temp_stopprice, "SnR Stop", "Short Entry");
    This generates the following code with TraceOrders = true:

    02/07/2009 07:00:00 Entered internal PlaceOrder() method at 02/07/2009 07:00:00: Action=SellShort OrderType=Stop Quantity=0.2M LimitPrice=0 StopPrice=1.6427 SignalName='Short Entry' FromEntrySignal=''

    02/07/2009 07:00:00 Entered internal PlaceOrder() method at 02/07/2009 07:00:00: Action=BuyToCover OrderType=Stop Quantity=0.4M LimitPrice=0 StopPrice=1.6457 SignalName='SnR Stop' FromEntrySignal='Short Entry'

    The NT behaviour I am seeing is that order is placed by NT with the correct amount (see screen shot attached).

    However, whenever this order executed the doubling of the quantity appears to be ignored, the position is closed out and not reversed (see screen shot attached).

    Other options(?):

    I have noticed on the forum that some are using EnterLong() and reversing the position with an equivalent EnterShort(). Here is one of the threads where EnterShort() / EnterLong() is discussed:



    I am hoping to avoid using Market entry orders as they exacerbate slippage. Are there any other options? Can limit and stop orders be used to reverse the positions?

    Thanks and regards,

    Dan
    Attached Files

    #2
    To reverse a position you should not use Exit(). Exit() will only close the open position and nothing more than that. You should use Enter(). If it sees an open position in the opposite direction it will automatically close that position and then get you into your desired reversal position. You do not need to use the market orders. You can use limit or stop orders for entering.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Thank you very much for your prompt, concise and clear response. I will head down that development path.

      Kind regards,

      Dan

      Comment


        #4
        Josh,

        I’ve now reviewed the associated documentation “Internal Order Handling Rules” and have found the following:

        Methods that generate orders (excluding market orders) to enter a position will be ignored if:
        ·A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
        ·A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
        ·The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction

        I should have been clearer in my original post; I am trying to combine two orders here to “bracket” a position. One, a stop loss order that reverses the position if triggered and two, a target order. To illustrate by an example, if we are long, I want a target order sitting 100 pips above the entry position. And I want a stop-loss order sitting 30 pips below the position which reverses the position if hit.

        My reading of this is that this can only be done with market orders, is that correct.

        As per your suggestion I have used the following:

        stoporder = EnterLongStop(0, true, (execution.Order.Quantity)*2, temp_stopprice, "SnR Stop");

        for the short case to reverse the position and the order is ignored with the “Internal Order Handling Rules” error message in the log.

        It is possibly best to clarify my question, is there any way to “bracket” a position in the way I have described above, while avoiding using market orders?

        Thanks and regards,

        Dan

        Comment


          #5
          Dan,

          You will not be able to bracket it like that. Instead what you should try doing is once your ExitLongStop() gets hit and filled, immediately place in a market order to reverse you. You can do this off of OnExecution() or OnOrderUpdate().
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Josh,

            Thank you very much for your prompt reply.

            Thank you also for the suggestion. I’ve been thinking about it while drafting my response.

            My thinking is that one is better off taking a slippage hit on a target order, than on a stop order. Therefore, I will use your original suggestion to reverse the position and have a market order to the exit of the position. Upon entry (using OnExecution()) I will find the target amount, then monitor that current price in OnBarUpdate() exiting the position if the target is hit via the ExitLong method below.

            ExitLong("Profit Target", "Long Entry");

            (I’m detailing the process for those whom come across the post in future.)

            Kind regards,

            Dan

            Comment


              #7
              A follow on question to this:

              I use a trailing stop to (hopefully) ride a trending market up. I would also like the ability if I get a signal to take on a short position while in the long position that I would just reverse the whole position. Also, to make things tricky I like the market moving in my direction so I only enter the market with stop orders. So, how do I go from a long position with a trailing stop to a short position using a stop order?

              Thanks!

              GT

              Comment


                #8
                As you are long, just place in EnterShortStop(). It will automatically close your long and reverse you when your stop price is hit.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                647 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X