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

Sample Cancel Order

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

    Sample Cancel Order

    Hello,

    referring the script "sample cancel order" I want to ask please when a limit-entry-order is cancelled via the NT7 control center tab "orders" by clicking "cancel" is this "recognized" in the script? Does the status of entryorder change from this? Because if not, then the script has to be disabled and enabled for a new trade and correct matching status, no?

    Thank you!
    Tony

    #2
    Hello tonynt, thanks for your note.

    If you cancel the order manually from the orders tab the strategy will not be aware of this. NT7 does not have a syncronize strategies option like NT8, so you would need to disable/re-enable the strategy to synchronize the strategy again.

    Kind regards.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hmm, that doesn't seem quite right ...

      I just tested my strategy using its profit target and stop loss order.
      My strategy enters a trade and then sets a profit target and stop loss order.
      Obviously, the profit target order is a Limit order, and the stop loss order is a Stop Order.

      I then went to the Control Center window.
      I used the Orders tab "+", "-", and "X" buttons to manipulate these 2 orders.
      (see Orders tab -> right-click menu -> Grid -> Properties to enable these 3 buttons)

      I clicked the "+" and "-" buttons to adjust the target and stop orders without issue.
      The strategy's OnOrderUpdate correctly received the change in the limit/stop price of the orders.

      I clicked the "X" button to cancel the target and stop orders and this, too, worked fine.
      The strategy's OnOrderUpdate correctly received the cancellation of the target/stop orders.

      ChrisL, are you sure you're correct?

      I mean, as far as I know, I did not have to adjust any setting or option to make my strategy's
      OnOrderUpdate react to the "+", "-", and "X" buttons from the Orders tab ...
      Last edited by bltdavid; 06-18-2019, 11:32 AM.

      Comment


        #4
        Hello ChrisL,

        thank you for confirming. To finish that NT7 script for our trading group I have one more question concerning the cancelling. I added the code from the "sample cancel order" (without the switching to mar****rder) and I´m experiencing a strange behavior. Even when I comment the onorderupdate with cancelling the entryorder is cancelled with new bar. The script is running COBCfalse. Is there anything by default in NT7 for cancelling orders with new bar that we are not aware of? That need to be excluded (but I cant find in the sample script)

        Thank you!
        Tony

        Comment


          #5
          Originally posted by bltdavid View Post
          Hmm, that doesn't seem quite right ...

          I just tested my strategy using its profit target and stop loss order.
          My strategy enters a trade and then sets a profit target and stop loss order.
          Obviously, the profit target order is a Limit order, and the stop loss order is a Stop Order.

          I then went to the Control Center window.
          I used the Orders tab "+", "-", and "X" buttons to manipulate these 2 orders.
          (see Orders tab -> right-click menu -> Grid -> Properties to enable these 3 buttons)

          I clicked the "+" and "-" buttons to adjust the target and stop orders without issue.
          The strategy's OnOrderUpdate correctly received the change in the limit/stop price of the orders.

          I clicked the "X" button to cancel the target and stop orders and this, too, worked fine.
          The strategy's OnOrderUpdate correctly received the cancellation of the target/stop orders.

          ChrisL, are you sure you're correct?

          I mean, as far as I know, I did not have to adjust any setting or option to make my strategy's
          OnOrderUpdate react to the "+", "-", and "X" buttons from the Orders tab ...
          Hello,

          I was referring on the entryorder.

          Best regards
          Tony

          Comment


            #6
            Hi,

            bltdavid I am not seeing an update from OnOrderUpdate when I cancel the stop. If you could post a script that does I would like to test it myself.

            tonynt The order is being canceled because you need to resubmit the order on every bar. See the section titled "Order Submission for Entry and Exit Methods - Basic Operation" on this page:



            Kind regards.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              bltdavid I am not seeing an update from OnOrderUpdate when I cancel the stop. If you could post a script that does I would like to test it myself.
              Really?
              It works absolutely perfectly fine, as expected.
              Extremely strange that you don't see your OnOrderUpdate receive the state change to Cancelled.
              Can you post the script your testing with?

              See my attached sample strategy.
              It uses Limit entry orders and will clearly show that using the "+", "-" and "X" buttons in the Orders
              tab is completely and 100% synchronized with the strategy's own OnOrderUpdate. Simple testing
              will show the sample strategy receives and prints the internal IOrder object for each and every order
              when that order gets adjusted manually via the Orders tab.

              I made a video of how I tested it.
              Attached Files
              Last edited by bltdavid; 06-19-2019, 09:50 AM.

              Comment


                #8
                Hello bitdavid,

                from my side thank you for your reply and the video!


                Tony
                Last edited by tonynt; 06-19-2019, 04:32 AM.

                Comment


                  #9
                  Originally posted by tonynt View Post
                  from my side thank you for your reply and the video!
                  You're welcome!
                  Glad you enjoyed it.

                  After the strategy creates the orders, you can also use the mouse in the Chart Trader enabled
                  window to adjust the orders via normal mouse drag-and-drop. The OnOrderUpdate will recognize
                  the order has changed (via the mouse) just like it does via the Orders tab (via the buttons).

                  I've been using both techniques for years, I've never seen them not work.

                  Comment


                    #10
                    Hello,

                    bltdavid thanks for confirming that. I'm not sure why my test was not working properly. I would expect the strategy to get an update for that order even when canceled externally.
                    Chris L.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by adeelshahzad, Today, 03:54 AM
                    5 responses
                    32 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by stafe, 04-15-2024, 08:34 PM
                    7 responses
                    32 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by merzo, 06-25-2023, 02:19 AM
                    10 responses
                    823 views
                    1 like
                    Last Post NinjaTrader_ChristopherJ  
                    Started by frankthearm, Today, 09:08 AM
                    5 responses
                    21 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    43 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X