Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancellation of stop loss order submitted twice

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

    Cancellation of stop loss order submitted twice

    Hi,
    My strategy shut itself down after exiting a position today as there was a duplicate request to cancel the unused stop loss order after my short was exited using a market order to close the position.
    I was short 2 lots, and closed out the position by buying back 2 lots at market, all via an automated strategy. Upon closing a positon via my strategy NinjaTrader then automatically takes care of any associated stop loss and profit target orders that were not filled by cancelling those unused orders.
    As expected, it cancelled the stop loss order, thus:

    28/11/2011 09:15:01|1|32|Order='0K7T6R386/DDT78244' Name='Stop loss' New state=PendingCancel Instrument='FGBL 12-11' Action=BuyToCover Limit price=0 Stop price=134.27 Quantity=1

    (Note, the position was filled at entry separately by 1 lot, then a second lot (partfilled, then filled), so there were in fact 2 stop loss orders and 2 profit target orders associated with the position - I refer here only to the first stop loss order (0K7T6R386, 1 lot) as that was the first one to be duplicated and hence caused the strategy shut down.)

    ...but before the broker's system could confirm this stop loss order as cancelled and could update the order status, a few lines later in the log (still at 09:15:01) the cancellation was requested for the same order (0k7T6R386) a second time, with 'NewState' again as 'PendingCancel'.

    This caused the following error message:
    'Order rejected: Broker or exchange option
    From Gateway: pending terminal action already exists for order 0K7T6R386 affected Order: BuyToCover 1 Stop @ 134.27'

    The cancellation of stop loss and profit target orders associated with the original short trade is not explicitly managed by my code, but is dealt with by the Ninja internal managed orders set up.
    Can anyone give guidance as to why this duplicate cancellation may have occurred, and how to prevent a re-occurence?
    many thanks

    #2
    Trace & log files have been sent to [email protected] - Jason at Support recommended the forum for further assistance with this issue. thanks

    Comment


      #3
      Hello,

      Thanks for the note.

      Can you tell me a little bit about how you are submitting the orders.

      Are you using two EnterLong() calls with different signal names?

      Also, what setting are you using in the strategy properties when running for Stop & target submission?

      I look forward to assisting you further.

      Comment


        #4
        Hi Brett,
        Thanks for looking into this for me.
        The short was entered on 2 lots via 'EnterLongLimit()'. This gave the entry line in the log file as follows:

        28/11/2011 08:31:01|1|32|Order='375086cdcc924defa79a07f0acc3b de8/DDT78244' Name='e1Short' New state=PendingSubmit Instrument='FGBL 12-11' Action=SellShort Limit price=134 Stop price=0 Quantity=2 Type=Limit Filled=0 Fill price=0 Error=NoErro

        As mentioned this was partfilled at 1 lot, then filled on the second lot, so there were 2 stop loss orders associated with this trade going forward, one for each fill:
        Order='0K7T6R386/DDTxxxxx' Name='Stop loss' New state=Working Instrument='FGBL 12-11' Action=BuyToCover Limit price=0 Stop price=134.27 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
        and
        Order='0K7T6R388/DDTxxxxx' Name='Stop loss' New state=Accepted Instrument='FGBL 12-11' Action=BuyToCover Limit price=0 Stop price=134.27 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''

        When I submit the stop loss and proftgt orders I use the same variable LastTrade='e1Short' so they are associated to that same trade:
        SetStopLoss(LastTrade, CalculationMode.Price, ShortLimitStopPrice, false);
        and
        SetProfitTarget(LastTrade, CalculationMode.Price, ShortLimitStopPrice - 1);

        The log file was sent to support desk but I can re-send to your mail direct if you prefer.
        thanks again

        Comment


          #5
          Hello,

          Thanks for that information.

          I have your logs from Jason.

          Name='NIstop' New state=Filled Instrument='FGBL 12-11'

          What is NIstop order submitted by?

          I look forward to assisting you further.

          Comment


            #6
            ExitShort(thisExit, LastTrade);

            where
            thisExit = "NIstop";

            thanks

            Comment


              #7
              Hello,

              In this case I would need to take a look at the code unfortunately.

              Can you please send in your strategy to support at ninjatrader dot com ATTN: Brett so that I can look further into this.

              -Brett

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by KennyK, 05-29-2017, 02:02 AM
              2 responses
              1,278 views
              0 likes
              Last Post marcus2300  
              Started by fernandobr, Today, 09:11 AM
              0 responses
              0 views
              0 likes
              Last Post fernandobr  
              Started by itrader46, Today, 09:04 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by timmbbo, Today, 08:59 AM
              0 responses
              2 views
              0 likes
              Last Post timmbbo
              by timmbbo
               
              Started by bmartz, 03-12-2024, 06:12 AM
              5 responses
              33 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Working...
              X