Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Duplication of orders

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

    Duplication of orders

    Hi!

    I use functions:
    Code:
    EnterLongStopMarket(0,true,pmLot,Highs[0][0] + 2 * TickSize,"Long");
    EnterShortStopMarket(0,true,pmLot,Lows[0][0] - 2 * TickSize,"Short");
    I came across duplicate orders, this is what I see in the log:
    HTML Code:
    6/23/2020 1:30:00 AM Strategy 'XXX/183993646': Entered internal SubmitOrderManaged() method at 6/23/2020 1:30:00 AM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=10110.00 SignalName='Short' FromEntrySignal=''
    
    name='XXX' id=183993646 Logger: NQ 09-20 6/23/2020 1:30:00 AM OnOrderUpdate1:Order (orderId='NT-00233-4559' account='Sim101' name='Short' orderState=Submitted instrument='NQ 09-20' orderAction=SellShort orderType='Stop Market' limitPrice=0 stopPrice=10110 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-06-23 01:30:00' gtd='2099-12-01' statementDate='2020-06-23') update: Submitted
    name='XXX' id=183993646 Logger: NQ 09-20 6/23/2020 1:30:00 AM OnOrderUpdate1:Order (orderId='NT-00233-4559' account='Sim101' name='Short' orderState=Accepted instrument='NQ 09-20' orderAction=SellShort orderType='Stop Market' limitPrice=0 stopPrice=10110 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-06-23 01:30:00' gtd='2099-12-01' statementDate='2020-06-23') update: Accepted
    name='XXX' id=183993646 Logger: NQ 09-20 6/23/2020 1:30:00 AM OnOrderUpdate1:Order (orderId='NT-00233-4559' account='Sim101' name='Short' orderState=Working instrument='NQ 09-20' orderAction=SellShort orderType='Stop Market' limitPrice=0 stopPrice=10110 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-06-23 01:30:00' gtd='2099-12-01' statementDate='2020-06-23') update: Working
    
    NinjaScript strategy 'XXX/183993646' submitting order
    
    name='XXX' id=183993646 Logger: NQ 09-20 6/23/2020 1:30:00 AM OnOrderUpdate1:Order (orderId='6204f69369794841ad37f830b12b897d' account='Sim101' name='Short' orderState=Submitted instrument='NQ 09-20' orderAction=SellShort orderType='Stop Market' limitPrice=0 stopPrice=10110 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=18047 time='2020-06-23 01:30:00' gtd='2099-12-01' statementDate='2020-06-23') update: Submitted
    name='XXX' id=183993646 Logger: NQ 09-20 6/23/2020 1:30:00 AM OnOrderUpdate1:Order (orderId='6204f69369794841ad37f830b12b897d' account='Sim101' name='Short' orderState=Accepted instrument='NQ 09-20' orderAction=SellShort orderType='Stop Market' limitPrice=0 stopPrice=10110 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=18047 time='2020-06-23 01:30:00' gtd='2099-12-01' statementDate='2020-06-23') update: Accepted
    Further, the order 6204f69369794841ad37f830b12b897d became market ("filled"), and the order NT-00233-4559 remained "working."

    Every time when I see the line "NinjaScript strategy 'XXX / 183993646' submitting order" - I see that the order is duplicated.

    Questions:
    1. Why was the order duplicated by creating two different instances of the Order class?

    2. What exactly does the string "NinjaScript strategy 'XXX / 183993646' submitting order" mean? It occurs only a few times, while the string "... Entered internal SubmitOrderManaged () ..." occurs more than 500 times.

    #2
    Hello webus,

    Initially the order is submitted and has an internal ID. Then the broker will generate an ID and this will be the new ID for the order.

    The order likely started with ID 6204f69369794841ad37f830b12b897d, and may have become NT-00233-4559.

    The message:
    "NinjaScript strategy 'XXX/183993646' submitting order"
    This would mean that a NinjaScript Strategy named XXX has submitted a real-time order.

    The message:
    "6/23/2020 1:30:00 AM Strategy 'XXX/183993646': Entered internal SubmitOrderManaged() method at 6/23/2020 1:30:00 AM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=10110.00 SignalName='Short' FromEntrySignal=''"

    This message is actually unexpected in the Log. This information looks like TraceOrders which I would not be expecting in the log file..

    Without the log and trace files it's hard to say what is going on.
    In general log and trace questions should be emailed to platformsupport [at] ninjatrader [dot] com so that we may review your log and trace.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi NinjaTrader_ChelseaB,

      Originally posted by NinjaTrader_ChelseaB View Post
      Hello webus,

      Initially the order is submitted and has an internal ID. Then the broker will generate an ID and this will be the new ID for the order.

      The order likely started with ID 6204f69369794841ad37f830b12b897d, and may have become NT-00233-4559.

      The message:
      "NinjaScript strategy 'XXX/183993646' submitting order"
      This would mean that a NinjaScript Strategy named XXX has submitted a real-time order.

      The message:
      "6/23/2020 1:30:00 AM Strategy 'XXX/183993646': Entered internal SubmitOrderManaged() method at 6/23/2020 1:30:00 AM: BarsInProgress=0 Action=SellShort OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=10110.00 SignalName='Short' FromEntrySignal=''"

      This message is actually unexpected in the Log. This information looks like TraceOrders which I would not be expecting in the log file..

      Without the log and trace files it's hard to say what is going on.
      In general log and trace questions should be emailed to platformsupport [at] ninjatrader [dot] com so that we may review your log and trace.
      Sorry, maybe this is important. This is a log from the NinjaScript output window.

      I think I can’t agree with you.
      Based on the log file, I see that “NT-00233-4559” was created after the order was opened, and only then “6204f69369794841ad37f830b12b897d” was created (please look at the order of the lines in the log above).

      My main question is why did NT8 create two different instances of the Order class from one call to the "EnterShortStopMarket()" function?

      Comment


        #4
        Hello webus,

        Do you see that the original ID was cancelled or filled?

        If not, the ID of the order probably changed. I will not be able to confirm without reviewing the log and trace files.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi NinjaTrader_ChelseaB,

          Originally posted by NinjaTrader_ChelseaB View Post
          Hello webus,

          Do you see that the original ID was cancelled or filled?

          If not, the ID of the order probably changed.
          Each order, which is called "Long" or "Short" and which has passed the "Accepted" state, I save to the array and log it every new bar (to see its status at the moment).
          Thus, I saved two orders: "'NT-00233-4559'" and "'6204f69369794841ad37f830b12b897d'". A few candles after that, the order '6204f69369794841ad37f830b12b897d' became 'Filled' and became a market position. 'NT-00233-4559' remained "Working" and did not become "Filled". Based on the logging, it remained "Working", it did not change to "Changed", "Cancelled", "Rejected", "Filled", etc.

          In other words, one call to the EnterShortStopMarket () function resulted in two orders, one of which became "Filled", and the second remained "Working."

          Originally posted by NinjaTrader_ChelseaB View Post
          I will not be able to confirm without reviewing the log and trace files.
          Ok, if I encounter such a problem again, I will also try to add the Trace log.


          ​​​​​​​

          Comment


            #6
            Hi NinjaTrader_ChelseaB,
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello webus,

            I will not be able to confirm without reviewing the log and trace files.
            The problem appeared again. I have a log file and a trace file. Could you give me mail where I can send them?

            Comment


              #7
              Hello webus,

              Please email platformsupport [at] ninjatrader [dot] com.
              If you have any questions, concerns or feedback, or want to open an account, we're here to help. Click here to find the appropriate contact for your needs!


              In the email include ticket ID 2618673.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hi NinjaTrader_ChelseaB,

                Originally posted by NinjaTrader_ChelseaB View Post
                Hello webus,

                Please email platformsupport [at] ninjatrader [dot] com.
                If you have any questions, concerns or feedback, or want to open an account, we're here to help. Click here to find the appropriate contact for your needs!


                In the email include ticket ID 2618673.
                Sorry, the first mail name is "Duplication of orders". I have sent a second mail with "ID 2618673".
                Last edited by webus; 06-25-2020, 11:20 AM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by alifarahani, Today, 09:40 AM
                6 responses
                36 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                14 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Waxavi, Today, 02:00 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by gentlebenthebear, Today, 01:30 AM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X