Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Submitting OCO orders to ThinkOrSwim

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

    Submitting OCO orders to ThinkOrSwim

    Based on ThinkOrSwim connection guide (https://ninjatrader.com/ConnectionGu...nnection-Guide), the connection with ThinkOrSwim support OCO but with some restrictions:
    • Once submitted, the orders that make up the OCO group cannot be modified
    • OCO orders need to submitted in pairs
    I am using UnManaged Order Management approach to use oco group parameter when using the SubmitOrderUnmanaged() method. How can I submit the OCO pair that ThinkOrSwim is expecting?

    Currently I am submitting to orders using the SubmitOrderUnmanaged() method, one for the StopLoss order and another for the TargetProfit order. Both orders are sharing the the OCO string and they are both getting triggered once the entry order has been reached execution.Order.OrderState == OrderState.Filled within OnExecutionUpdate() method. The pair is getting submitted by two separate SubmitOrderUnmanaged() calls. Does this constitutes the OCO pair that ThinkOrSwim is expecting?

    #2
    Hello GARZONJ

    Use the same OCO Id and make sure they are submitted at the same time and not at different times. This means they have to submitted simultaneously.

    If they are using OCO Ids, you will be able to confirm this on the Orders tab of the Control Center. If both orders are using the same OCO Id and both orders are filling, this would need to be reported to TD Ameritrade, as that would be a brokerage server side issue.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      I have come across the WaitForOcoClosingBracket strategy setting.

      According to the documentation, the default value is True.

      How is that NT send the pair to the broker?

      In my code I first create an OCO string, then create the StopLoss order (using SubmitOrderUnmanaged()) and then create the TargetProfit order (using SubmitOrderUnmanaged()) using the same OCO string.

      Because of WaitForOcoClosingBracket = True, does NT submits the the pair to the Broker (TOS in this case) until the executing the second SubmitOrderUnmanaged()? NT knows that I have a pair and only then submits the pair to ThinkOrSwim?

      Please help me clarify this?

      Comment


        #4
        Hello GARZONJ,

        Apologies, this forum post appears to not have notified our queuing system.

        Unfortunately, the WaitForOcoClosingBracket only applies to Set methods with the managed approach (such as SetStopLoss() and SetProfitTarget()). This will not have effect with an unmanaged strategy.
        https://ninjatrader.com/support/help...ingbracket.htm

        This would mean custom logic is necessary to wait until the conditions are right to place both orders, before submitting the orders simultaneously.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by geotrades1, Today, 10:02 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by ender_wiggum, Today, 09:50 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by rajendrasubedi2023, Today, 09:50 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by bmartz, Today, 09:30 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by geddyisodin, Today, 05:20 AM
        3 responses
        27 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X