Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OCO ID Can Not Be Reused - Causing profit/loss targets to be ignores?

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

    OCO ID Can Not Be Reused - Causing profit/loss targets to be ignores?


    How can I prevent this error, "The OCO ID cannot be reused"?

    I like to sim test many strategies, up to a thousand. However, I notice the more strategies I test, the more apt I'm to encounter this error of OCO ID. I can only speculate there is some sort of timing issue. When I have two different strategies creating an order at nearly the same time, the system isn't able to issue independent OCO IDs to each?

    Then, this issue seems to caused a secondary error. All of my strategies set a profit/loss at 6 ticks. However, on some strategies, the profit/loss is never obeyed. The strategy never closes, even at end of trading day, when I have to close it manually.

    Therefore, I can only think there's some timing conflict going on, with running so many strategies simultaniously.

    Would you have any thoughts on how to correct this? Thanks,








    Attached Files

    #2
    Hello timmbbo,

    We would need more specific details here about what orders you are using that have OCO. Targets generally have OCO, are you using the managed approach and the Set methods or are you using the Unmanaged approach and using your own OCO ids?

    Comment


      #3

      Jesse, thanks. My orders are managed. I am using:


      SetStopLoss(6 ticks)
      SetProfitTarget(6 ticks)
      EnterLongLimit(at desired price point)


      and let my trade execute.

      Comment


        #4
        Hello timmbbo,

        What connection is being used and can you provide a simplified example of a situation that causes this error? If you have a very basic script and steps that reproduce the error on a specific connection we can review that further.

        Comment


          #5

          Jesse, thanks. First, I'm using different connections, to LeeLoo Trading and Apex Trading. I get this error with both of them, so it's not connection related. Then, frustratingly, I can not reproduce this error. That's because this error depends upon timing, rather than logical flow. I can say this error is related to the number of strategies I'm running. When I'm running 10 strategies, no problems. When I load up to a thousand strategies and test them, then I get this error plenty, and my strategies no longer obey set profit/loss.

          Here's what I'm thinking. I'm the only guy nutty enough to load up 1K strategies, so your software really hasn't been tested to this limit. There's a centralized resource allocating IDs for trades. When I have multiple trades going off simultaneously requesting trade IDs, that centralized resource is getting trade requests so quickly, it's started to get mixed up IDs between the trades.

          Your thoughts? Thanks,

          Comment


            #6
            Hello timmbbo,

            Are you running the strategies on the same instrument? If so that likely is the problem, that would not be suggested to run more than 1 strategy on a given instrument. If you have multiple sets of logic that you wanted to execute on a single instrument then you would want to combine all of that into a single script.

            If you are using one strategy per instrument and still seeing that error then it may be related to the quantity of strategies requesting an OCO at a single time. Generally you wouldn't be able to run that many strategies at once due to the provider data subscription limitations, each strategy needs to have a data subscription and most providers limit the number of instruments that can be subscribed to.

            Comment


              #7

              Jess, hi there, yes, I'm running many strategies on the same instrument within the same chart. As I mentioned, I like to test up to 1K strategies simultaneously. So I load about 100 per chart and activate them. So, yes, many of these strategies will be firing off at the exact same moment.

              Given this, can you think of a programmatic way to address this error? Thanks,

              Comment


                #8
                Hello timmbbo,

                I would suggest to combine the strategies into one strategy and then make sure that works as expected. As mentioned it is not suggested to run more than 1 strategy per instrument. Strategies are not intended to be used in tandem and are isolated. If two strategies are doing conflicting actions you may see errors in the platform because the strategies are not aware of what other strategies are doing.

                Comment


                  #9
                  Hello, I'm experiencing the same issue even though I run the same strategy on different instruments. What's the explanation for this behavior?

                  Comment


                    #10
                    Hello Nyman,

                    The information already posted in this thread would still apply for a different instrument. If you are not clear on some part of this thread I would suggest to make a new thread of your own and include any specific questions that you have related to the OCO cannot be reused error. Again that is an expected secondary error when one part of an OCO pair is rejected.

                    Comment


                      #11
                      Hello everyone,
                      If someone is still interested in finding a solution to the above issue, then I can report that I have found the fix to the problem. Every market position must be entered using a unique DI to avoid the OCO ID resue.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Yesterday, 05:17 AM
                      0 responses
                      54 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      130 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      71 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      44 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      49 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X