Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I cancel a limit ENTRY order after a partial fill with NinjaScript?

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

    How do I cancel a limit ENTRY order after a partial fill with NinjaScript?

    I have the following two questions on the subject of advanced order management using NinjaScript:

    1) How do I cancel a limit ENTRY order after a partial fill with NinjaScript (i.e., stop trading the limit order for the remaining quantity)?

    2) How do I modify a limit ENTRY order after a partial fill with NinjaScript(i.e., alter the limit order paramaters for the remaining quantity)?

    Thanks,

    Jian

    #2
    Hello QTrader,

    Welcome to the NinjaTrader forums!

    You can work in IExecution interface to check fill quantity of specific orders.

    There is also available order state PartFilled that you can check for.

    The reference sample we have on CancelOrder() can help setting this up:
    When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until


    To modify an order: You submit an updated statement with the new parameters.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello Ryan,

      Thank you very much for your quick & very helpful reply. Just want to confirm that when using the following syntax:

      EnterLongLimit
      ( int barsInProgressIndex,
      bool liveUntilCancelled,
      int quantity,
      double limitPrice,
      string signalName
      )

      to issue a replacement (or modifying) LIMIT ENTRY order after a partial fill, it is the signalName passed as a parameter that will uniquely identify the original LIMIT ENTRY order for order change?

      Also, will the IOrder.Token (NOT IOrder itself) object returned from the 2nd (replacement) EnterLongLimit call be different from that of the 1st (orginal) EnterLongLimit call?

      Thank you very much for your help!

      QTrader

      Comment


        #4
        Yes, it is the signal name that will match the prior order with the new one.

        .Token property is no longer used in version 7 for comparing equality. You compare objects directly. For modifying the orders then, you must be update the object references with the new modified order and manage anytime this must be reset.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thank you very much for your confirmation & additional info provided on .Token. I will upgrade NinjaTrader to Version 7 and look into the features of object references & updates as you described.

          Thanks,

          QTrader

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,607 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          15 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X