• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel unfilled order

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

    Cancel unfilled order

    If I have an order that remains liva tilll closed, how do I close it?

    #2
    Hi malcolm, thanks for your question.

    You can use the CancelOrder method. See below for a full example:

    https://ninjatrader.com/support/help...thod_to_ca.htm

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi ChrisL, thanks for the response. In the images, you can see the order is not being cancelled, below is the code, I am sure I am making a simple error, but I can't see it.

      if (myLongEntryOrder != null && TradeNow == false)
      {
      Print("hello");
      Print(myLongEntryOrder.OrderId);
      Print(myLongEntryOrder.Name);
      Print( "No Trade Now ");
      CancelOrder(myLongEntryOrder);
      }

      Attached Files

      Comment


        #4
        Hi malcom, thanks for your reply.

        We have a full example on how to use CancelOrder in your strategy. Please see below:

        https://ninjatrader.com/support/help...thod_to_ca.htm

        Are you setting up the order object in OnOrderUpdate. Also it looks like your not checking for the order state before canceling, consider printing this out as well for more information on the active orders.

        I look forward to hearing from you.
        Last edited by NinjaTrader_ChrisL; 06-11-2020, 10:59 AM. Reason: Added more detail to the post.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by terminatorT1000, Today, 01:23 AM
        0 responses
        5 views
        0 likes
        Last Post terminatorT1000  
        Started by jointnusa, Today, 01:00 AM
        0 responses
        6 views
        0 likes
        Last Post jointnusa  
        Started by jointnusa, Today, 12:59 AM
        0 responses
        5 views
        0 likes
        Last Post jointnusa  
        Started by alstondn, Today, 12:15 AM
        0 responses
        5 views
        0 likes
        Last Post alstondn  
        Started by kettyrstes, Yesterday, 11:40 PM
        0 responses
        4 views
        0 likes
        Last Post kettyrstes  
        Working...
        X