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

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.
    Paul H.NinjaTrader Customer Service

    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


        Paul H.NinjaTrader Customer Service

        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).

            Paul H.NinjaTrader Customer Service

            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 yertle, Yesterday, 08:38 AM
                7 responses
                28 views
                0 likes
                Last Post yertle
                by yertle
                 
                Started by bmartz, 03-12-2024, 06:12 AM
                2 responses
                21 views
                0 likes
                Last Post bmartz
                by bmartz
                 
                Started by funk10101, Today, 12:02 AM
                0 responses
                4 views
                0 likes
                Last Post funk10101  
                Started by gravdigaz6, Yesterday, 11:40 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by MarianApalaghiei, Yesterday, 10:49 PM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X