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

Un-identified stop order

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

    Un-identified stop order

    Hi, thank you for helping.

    I am getting an error (see attachment) , that an un-identified stop order has been rejected (see also orders TAB in attachment)

    As you can see in the orders TAB marked in red, the stop order has a very weird ID.

    Do you have any idea where it is coming from? the quantity is not correct. The stock is BBBY,
    you can see that I entered with the quantity of 1796, then it put a weird stop of 100, and then, the proper stop of the full position.

    If you are familiar with this, it will be awesome, thanks for helping.
    Attached Files

    #2
    Hello zoharcho,

    Thank you for your post.

    The weird number would be an internal order number assigned to the order until it reaches the broker, when it then receives an order number from them.

    However, why the odd stop was placed would be nearly impossible to say without seeing the strategy itself. Is this a strategy you've programmed yourself, or one received from a third party vendor?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate, you are totally correct, I debug the issue, and I have located it to the first piece when a big order is executing @ OnExecutedUpdate
      I used the example code for realtime-fast stoploss orders when there is partial execution.

      For some reason, the first piece in the partial execution is getting rejected as in the picture.

      Does this information help you? help me?

      Comment


        #4
        Hello zoharcho,

        Thank you for your reply.

        Who is your data provider? Some do not guarantee the order in which Order/Execution/Position updates are received, so that could make a difference in handling.

        Could you provide a sample of the code you're using to handle the placement of stop loss orders in a partial fill scenario in OnExecutionUpdate?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          I am using Interactive Brokers + I am testing it on the demo account (maybe on real it will not do the problem?)

          See the Image, this is the standard code.

          P.S.
          this issue doesn't happen all the time

          thank you
          Attached Files

          Comment


            #6
            Hello zoharcho,

            Thank you for your reply

            Interactive Brokers is one of those that does not guarantee the order of Order/Execution/Position updates and it's very likely this is the root cause of the issue. It's very possible that an out of order update is causing the strategy to incorrectly place the stop.



            We would recommend using the Unmanaged Approach rather than the Managed Approach if you're hitting issues like this with a strategy running on an Interactive Brokers connection. The Unmanaged Approach allows you to calculate the position internally to the strategy without relying on position or execution updates in a particular order.

            I'm attaching an example script below.

            If you test with this do you see the issue with the stops?

            Thanks in advance; I look forward to assisting you further.
            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Thank you Kate, the more example code, my ninja code skills are growing LOL, thank you will check it out.

              BTW, the issue currently does not impact the functionality of the strategy, it functions well it just the first piece sometimes reject, but then it immediately correct and the stop is set well.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Jltarrau, Today, 05:57 AM
              3 responses
              6 views
              0 likes
              Last Post Jltarrau  
              Started by f.saeidi, Today, 05:56 AM
              2 responses
              8 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              36 views
              0 likes
              Last Post Pattontje  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              7 responses
              27 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Skifree, Today, 03:41 AM
              2 responses
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X