Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sample for OCO orders ?

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

    Sample for OCO orders ?

    Hi,

    I would like to make an OCO order in order to tie my exit and stop orders.

    I don't use predefined target so the SetProfitTarget does not suit my needs.

    Is there a sample for defining OCO orders ?

    W.

    #2
    Hello,

    This would require unmanaged approach to submitting orders to do this. However before I send you information on how to do this may I ask if the SetProfitTarget does not work for you if you knew that SetProfitTarget and SetStopLoss can by dynamic meaning you can update the values in OnBarUpdate(). You can use this sample to do this. If this doesn't work for you let me know and I can send you information for unmanaged approach. As you want to try and stay away from unmanaged approach if you dont need to do it as it is reserved for advanced programmers only.



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thank you Brett,

      I use for my actual exit ExitLong/ExitLongLimit..

      Are you saying I should use something like SetProfitTarget(CalculationMode.Ticks, 0) instead of ExitLong ?

      W.

      Comment


        #4
        Hello,

        Right or more precisely I would use SetProfitTarget(CalculationMode.Price, Your Submitted Profit target price) and with SetStopLoss also.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Hi Brett,

          I looked at the unmanaged mode, but I can't see OCO orders ?

          Have I missed something ? Is there an OCO sample ?

          W.

          Comment


            #6
            wingman, the SubmitOrder() method offers an ocoid string to link orders together. If you have for example 2 orders with the same string and one order of your entry bracket fills first, the other would be cancelled by NT then.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            663 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            376 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X