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

CancelOrder and EnterShortStop on same bar

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

    CancelOrder and EnterShortStop on same bar

    I am using Managed order handling.

    At the beginning of OnBarUpdate()
    1. I have an IOrder long = EnterLongStop that (as of the previous bar) has OrderState = Working
    2. I call CancelOrder(long)
    3. Later in the same OnBarUpdate() I call IOrder short = EnterShortStop(...)


    This sequence produces the following error for the EnterShortStop attempt:

    **NT** An Enter() method to submit an entry order at '4/29/2015 13:58:02' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
    but then I see two successful OnOrderUpdate callbacks for the "long" order cancellation.

    Is there a workaround for this so that I can cancel a pending stop order and enter a new one in the same OnBarUpdate()?

    #2
    Hello dbooksta,

    Thank you for your post.

    Likely an ExitLong method is in place as well that needs to be cancelled first. You also may be running into the fact that the same call to OnBarUpdate() will not have cancelled the EnterLong when you go to submit the EnterShort. I would recommend enabling TraceOrders and monitoring the Output window to see the sequence of events that you are running into.

    For information on TraceOrders please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3627

    Please let me know if I may be of further assistance.

    Comment


      #3
      Pretty much what I describe:

      13:57:47 entering long stop at 4777.61
      13:57:47 Buy at 4777.61 PendingSubmit
      13:57:47 Buy at 4777.61 Accepted
      13:57:47 Buy at 4777.61 Working
      13:58:02 entering short stop at 4773.99
      **NT** An Enter() method to submit an entry order at '4/29/2015 13:58:02' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
      13:58:02 Buy at 4777.61 PendingCancel
      13:58:02 Buy at 4777.61 Cancelled

      Comment


        #4
        Hello dbooksta,

        Thank you for your response.

        You would need to check that the Enter Long is cancelled first, then place the Enter Short. If one is working (the cancel has not gone through yet) the other will be ignored per the Internal Order Handling Rules at the following link: http://www.ninjatrader.com/support/h...d_approach.htm

        Please let me know if you have any questions.

        Comment


          #5
          I don't see what in the Internal Order Handling Rules is violated by putting an EnterStopLong before an EnterStopShort has cancelled -- especially if I give them different signal names.

          I also can't see any method of accomplishing what you describe that is not extremely kuldgey -- e.g., are you saying that I should have two paths through OnBarUpdate and make a second callback when I get an OnOrderUpdate showing "Cancelled"?

          There must be some way to "flush" the order handling within OnBarUpdate so that I can just do a single pass through the logic of canceling one and entering another.
          Last edited by dbooksta; 05-29-2015, 02:44 PM.

          Comment


            #6
            Originally posted by dbooksta View Post
            I don't see what in the Internal Order Handling Rules is violated by putting an EnterStopLong before an EnterStopShort has cancelled -- especially if I give them different signal names.

            I also can't see any method of accomplishing what you describe that is not extremely kuldgey -- e.g., are you saying that I should have two paths through OnBarUpdate and make a second callback when I get an OnOrderUpdate showing "Cancelled"?

            There must be some way to "flush" the order handling within OnBarUpdate so that I can just do a single pass through the logic of canceling one and entering another.
            There is not. We have been down this road a long time ago:

            ref: http://www.ninjatrader.com/support/f...d.php?p=231759
            ref: http://www.ninjatrader.com/support/f...d.php?p=207036

            And before any NT staffer again tells me that I misunderstand and have personal coding problems, here is what NT_Bertrand says: confirming what I have said all along.

            ref: http://www.ninjatrader.com/support/f...48&postcount=1

            It is the last comment in the second of the threads that I cited previously.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Skifree, Today, 03:41 AM
            1 response
            2 views
            0 likes
            Last Post Skifree
            by Skifree
             
            Started by usazencort, Today, 01:16 AM
            0 responses
            1 view
            0 likes
            Last Post usazencort  
            Started by kaywai, 09-01-2023, 08:44 PM
            5 responses
            603 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            6 responses
            23 views
            0 likes
            Last Post xiinteractive  
            Started by Pattontje, Yesterday, 02:10 PM
            2 responses
            23 views
            0 likes
            Last Post Pattontje  
            Working...
            X