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

How to cancel order that was set up with isLiveUntilCancelled: false?

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

    How to cancel order that was set up with isLiveUntilCancelled: false?

    Hello,

    I'd appreciate your support

    I've set an order with the following method:

    myOrder = EnterLongStopMarket(barsInProgressIndex: 0, isLiveUntilCancelled: false, quantity: DefaultQuantity, stopPrice: GetCurrentAsk() * 1.01, signalName: string.Empty);

    As of my knowledge if I have "isLiveUntilCancelled": false I must wait for the current bar to finish for this order to expire, but what can I do if it IsLiveUntilCancelled is false and let's way I want to cancel it before the bar closes, with something like a button for example? I've tried setting up a button to cancel the order, and it doesn't work, doesn't do anything.

    Regards,

    #2
    Hello Waxavi,

    A live until cancel false order will expire after 1 bar, you cannot cancel that type of order in code. If your logic has opportunities to cancel the order before the end of the bar you need to use true so that it can be cancelled instead of expired.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Thanks for answering me so quickly, I've also noticed that if I click on the X (cancel the order manually) my strategy stops responding properly (I have for example a custom button on a chart panel to place a buy order and it stops working after I hit that X) Is there something I can do to prevent this conflict?

      Regards,

      Comment


        #4
        Helllo Waxavi,

        Strategies are not intended to be used with manual actions from other tools. The strategy won't know you cancelled the order. A custom button can be used to cancel an order but it needs to be live until cancelled = true.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Understood, Thanks for your response.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          834 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,290 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          10 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          8 views
          0 likes
          Last Post Option Whisperer  
          Working...
          X