Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop and Reverse with Unmanaged Approach

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

    Stop and Reverse with Unmanaged Approach

    I have a breakout system that in its simplest form puts stop entry orders on both sides of the market. Then when one is hit stop loss and profit target orders are submitted.

    Because the stop loss is normally the same as the opposite side stop entry order, both orders will execute given that price is hit.

    It appears these orders are executed in the order they were submitted to the market, which makes sense. Because my opposite side entry is hit first, that entry actually takes me flat and the stop loss takes me back into a position (in this case long).

    Do these orders execute in the order they are entered and if so, will simply cancelling the entry order once I put out a stop loss and then immediately resubmitting the entry order get the executions in the right sequence?

    Is there a better way to ensure the stop executes first so I am flat when I get the entry order execution?

    Thanks

    #2
    ScottB, are those StopMarket's or StopLimit's orders working in your brackets? You could also submit a market order in OnExecution() once you're stop reports filled, this should provide proper sequencing then.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand, The entry order (placed first) is a stop limit with 1 tick between the stop and the limit and the stop loss is a stop market. This is also simulation which means your order execution rules are in the mix. I primarily wondered if there is a known solution or anything in the parameters of the orders that would help.

      I do place the stop loss in OnExecution but unfortunately this is after the entry orders have been placed so apparently the stop loss is behind the stop limit entry in line. I assumed since it was a stop limit entry that the stop price would trigger the limit order which would execute after the stop loss order (who knows where I came up with that logic).

      I have a number of solutions at a logic level such as simply cancel the entry stop limit when I put out the stop loss and then immediately resubmit the entry order to put it at the back of the queue. Of course, it may not be a FIFO issue, it may be that there is no guarantee of execution sequence.

      It appears NinjaTrader will report the entry order as closing the position (in the case of a long, a buy order) and then the stop loss (buytocover) opening a new position. Unless there are other factors, if I handle my orders correctly internally, this will just look funny on the execution tab but have no real effect on the strategy.

      As always, thanks for your help.

      Comment


        #4
        You're welcome Scott, there's indeed no execution sequence guarantee, both are being triggered by the same price, so likely the market order is quicker in than the 'in price q' waiting limit, though if someone steps in taking all liquidity that may be different or at least pretty close to equal.

        If you're going unmanaged, there really is no signal tracking by NT (otherwise the handling rules would be there again), so it would just tie them together in the executed sequence. If you're handling potential overfills and sync there should be no effect on the strategy as you noted.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks for the reply Bertrand. No guarantee of execution order is what I thought was going to be the answer. I am going to have to handle this purely with code logic (drats).

          From a NinjaTrader order submission/execution handling perspective, is there any difference between my entry order closing a position via Buy and then my stop loss taking me into a position via a BuyToCover vs. the intended BuyToCover stop loss followed by the Buy entry?

          I am trying to identify any gotcha's given that I want the same price on both orders but cannot guarantee the sequence of their execution.

          Comment


            #6
            There's none in your unmanaged environment - you only eitiher Submit, Cancel or ChangeOrder here. I will think about it, but to get matchting prices I would take out the part involving the market order, so both could be limit order at your designated price...but then it may leave you unfilled at times.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Bertrand, as I understand your reply there is no difference in SubmitOrder between Buy and BuyToCover. This gives me the option of using one order with the stoploss and entry amount or handling fills based on position change (short to flat to long) rather than which order got filled (stop loss vs. entry).

              Thanks for your help.

              Comment


                #8
                There's no functional difference in terms of the outcome - they are just provided for proper tagging, some brokerage adapters require you to BuyToCover instead just issueing a Buy (mostly equities related).
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Perfect, thanks so much for all your help.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Rapine Heihei, 04-23-2024, 07:51 PM
                  2 responses
                  30 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by Shansen, 08-30-2019, 10:18 PM
                  24 responses
                  943 views
                  0 likes
                  Last Post spwizard  
                  Started by Max238, Today, 01:28 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by rocketman7, Today, 01:00 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post rocketman7  
                  Started by wzgy0920, 04-20-2024, 06:09 PM
                  2 responses
                  28 views
                  0 likes
                  Last Post wzgy0920  
                  Working...
                  X