• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by U0000999, Today, 05:44 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by Teebone21, Today, 10:38 AM
        2 responses
        9 views
        0 likes
        Last Post Teebone21  
        Started by futurestrader7, Today, 11:31 AM
        0 responses
        3 views
        0 likes
        Last Post futurestrader7  
        Started by J_o_s, 03-30-2020, 12:29 AM
        2 responses
        16 views
        0 likes
        Last Post J_o_s
        by J_o_s
         
        Started by ptpatrader, Today, 10:27 AM
        2 responses
        7 views
        0 likes
        Last Post ptpatrader  
        Working...
        X