Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO issues cancelling entry orders on partial fills

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

    OCO issues cancelling entry orders on partial fills

    I am having an issue with partial fills. The seed order is not always being cancelled when the profit order is hit and the strategy is flat.

    I am using EnterLongLimit() to enter the position and keeping the returned IOrder. I sometimes use this to cancel orders using CancelOrder().

    When there is a partial fill and then the position exits with a limit order. The strategy is now flat, however the IOrder for the seed entry order is set by NT to null so it is lost and cannot be used to cancel the "remnant" entry order. Any suggestions?

    All works well on full fills since there is no "remnants".

    Thanks.
    Tony

    #2
    Hello,

    Can you give me an idea of what methods you are working in? Are you checking the state of the order in OnOrderUpdate() before you try canceling the order? If you have not yet, please review our Help Guide on this method for more informaiton: http://www.ninjatrader.com/support/h...rderupdate.htm

    NinjaTrader shouldn't be setting the order to null - this would be managed in your code depending on the conditional statements you are using.

    You could also try putting in a check in OnPositionUpdate() for when the position is returned as flat to cancel the remaining order.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by tony98 View Post
      I am having an issue with partial fills. The seed order is not always being cancelled when the profit order is hit and the strategy is flat.

      I am using EnterLongLimit() to enter the position and keeping the returned IOrder. I sometimes use this to cancel orders using CancelOrder().

      When there is a partial fill and then the position exits with a limit order. The strategy is now flat, however the IOrder for the seed entry order is set by NT to null so it is lost and cannot be used to cancel the "remnant" entry order. Any suggestions?

      All works well on full fills since there is no "remnants".

      Thanks.
      Tony
      Put in a fail safe.

      Code:
      protected override  void OnPositionUpdate(IPosition position)
      {
          if  (position.MarketPosition == MarketPosition.Flat)
          {
                ExitLong(); //unconditional exits
                ExitShort();
                // then Cancel and set all IOrders to null, just in case. After all, this is a sledgehammer failsafe.
          }
      }
      Last edited by koganam; 01-31-2012, 03:19 PM.

      Comment


        #4
        Thanks Matthew an Kogaman. It was my error. There was logic setting it null.

        Tony

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X