Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Strategy Error "The OCO ID 'xxxxx' cannot be reused. Please use new OCO ID."

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

    NT8 Strategy Error "The OCO ID 'xxxxx' cannot be reused. Please use new OCO ID."

    Hello Support,

    The strategy submits Market Orders using OCO for Profit Target and Stoploss. The strategy uses Managed Approach with SetProfitTarget and SetStoploss methods.

    I've never had to care about the OCO ID of any Strategy generated order ?

    What can I code into the strategy that will ensure a Unique OCO ID ?

    Thank you

    #2
    Hello rayko,

    Thanks for your post.

    What version of NT8 are you using? (Look under Help>About)

    Is this a strategy builder strategy or a Ninjascript based strategy?

    Does this occur on every order or occasionally?

    Please post a simplified version of your strategy that demonstrates the issue so we may test.

    Alternatively, please write into PlatformSupport[at]NinjaTradaer[dot]Com, mark the e-mail Atten: Paul and include a link to this thread.

    Comment


      #3
      The Version is 8.0.17.1.

      The strategy started out as builder strategy that I later released so I could customize it.

      The error occurs occasionally.

      I'll try to create something for you, however it would really help if you could tell me what NT8 is using to derive the OCO ID.

      Is it OrderName and is there a limit on the string length ?

      For example for OCO ID to be unique the ordername must be less than 30 characters and cannot include $#%& (special charactors) or something.... (I'm just spit balling as to why...)

      Please let me know.

      Comment


        #4
        Hello rayco,

        Thanks for your reply.

        For example of OCO ids, you can check the "Orders" tab of the control center under the OCO column. (If no information you can place a couple of orders in SIM101 with an ATM to see what is generated).

        I do not know what the string length limit is and will inquire further.

        I would not use special characters but I have no information advising that specifically and have not tested this.

        A colleague has advised you could use System.Guid.NewGuid() to generate a unique OCO-ID string


        Comment


          #5
          This is an NT8 bug. You get the same error message when trading manually off the chart trader. OCOs worked fine in NT7.

          Comment


            #6
            Hello JohnFortune,

            Thanks for your first post.

            Regarding, "You get the same error message when trading manually off the chart trader." That would be true if you did not turn of the OCO after creating the order (Same as NT7). The NT8 help guide very explicitly advises, "Warning: After placing two orders within the same OCO group, it is important to disable OCO functionality before submitting any other orders. If you wish to place another set of OCO orders immediately after placing an initial set, first disable, then re-enable OCO before placing the second set of orders. This will generate a new OCO ID, rather than adding the new orders to an existing OCO group." Found in the section, " Understanding "One Cancels Other" (OCO) orders" on this page: https://ninjatrader.com/support/help...ng_orders4.htm

            If you wish to report a bug, please provide the specific steps and circumstances to recreate and we will be glad to investigate. We will also need to know what specific version of NinjaTrader8 you are using (found under Help>About).

            Comment


              #7
              How do I Auto-Reset OCO ID using ninjascript?

              Comment


                #8
                Hello stevenrosenquist,

                With the unmanaged approach, you can generate a new unique OCO ID using GetAtmStrategyUniqueId().


                (Or you can use GUID.NewGuid)
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                41 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                124 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                64 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                41 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                46 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X