Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Account.Submit for orders, OCO and Partial Fill

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

    Account.Submit for orders, OCO and Partial Fill

    Consider the following scenario for this discussion.
    1. Entry order is placed long with a quantity of 100 and filled.
    2. A limit order and stop order is created after being filled. The limit order is for a quantity of 50, and the stop order is created as a quantity of 100. They are both part of the same OCO group.
    3. The limit order is now partially filled, say with a fill quantity of 10.
    Executing the above scenario using the API's in Account class, or executing using the chart trader is providing the same results. Testing was performed using live market data and a simulation account.

    As the limit order is partially filled, the stop order quantity adjusts. The stop order quantity adjusts as a percent. After step 3, the limit order will now be for 40, as expected, but the stop order will now be for 80.

    If the instrument then moves to stop out the rest of the order, there will be a quantity of 10 left unfilled.

    If the above scenario is executed via code, code in the ExecutionUpdate event handler for Account could adjust the stop order to make sure it will close out the position and not leave the 10 shares hanging. The code however will be running on the users computer, and not at the broker. This leads to the following questions.

    Is the OCO mechanism for orders handled completely locally and not by the broker?

    #2
    Hello ntbone ,

    OCO handling varies depending on the broker being used and settings chosen. In some situations you have the option to enable local OCO when configuring a connection such as the NinjaTrader brokerage. Other connections which default to local OCO will present a warning when configuring the connection that OCO is being simulated, other connections may use server side OCO.



    Please let me know if I may be of further assistance.

    Comment


      #3
      Thanks.

      What is the best way to override NinjaTrader's OCO behavior?

      I have some code that is attempting to update the stop orders with the desired quantity changes, but the default OCO behavior for simulation accounts is still applying its changes first. I am not sure when it applies it so timing seems important, otherwise its possibly my changes could be overridden but it would also be nice to not have that extra redundant change.

      Comment


        #4
        Hello ntbone,

        You cannot change the behavior of OCO, this is controlled internally or by the broker depending on the situation/connection used. If you want to do something other than what the default OCO handling does, you would need to not use OCO and just use logic of your own to control your targets.

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X