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 samish18, Today, 01:01 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by WHICKED, Today, 12:56 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cre8able, Today, 01:16 PM
          0 responses
          3 views
          0 likes
          Last Post cre8able  
          Started by chbruno, 04-24-2024, 04:10 PM
          2 responses
          47 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by WHICKED, Today, 12:45 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X