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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        64 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X