Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Vexed on "The OCO ID cannot be reused"

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

    Vexed on "The OCO ID cannot be reused"


    My strategy generates the error "The OCO ID cannot be reused"​ I'm aware the stock answer is:

    The error "The OCO ID cannot be reused" indicates that your strategy has submitted an order that is reusing an OCO ID. You would need to ensure that the strategy instance is submitting new OCO-tied orders using unique OCO IDs.​

    What is unclear to me is, how do I control the OCO ID at the program level, especially since it appears to be an internal resource?

    I've searched all through the documentation, and I can find no method that provides direct access to the OCO ID. Second, when the OCO ID does appear in an error message, it's a long string of random characters, nothing that I certainly set at the programmatic level. I've also tried all variations of EnterLong() and EnterLongLimit(), and I still get this error.

    I am aware of ChelsaB code example on OCO orders (2 entry orders help! - NinjaTrader Support Forum​) The bummer of that approach is, I then need to move to unmanaged orders, which becomes more complex.

    You can see, I have major confusion on this. Given that this OCO ID appears to be internally generated, that I have no direct programmatic access to it, how exactly I'm supposed to modify my code to avoid this error condition?

    Thanks


    #2

    Guys, with further sleuthing, I found my answer at:

    OCO ID reused - NinjaTrader Support Forum

    It turns out that I needed to enhance the error handling to accommodate when this error does happen, to exit my trade when the profit and stop loss do not get set.

    No further action is needed on your end. Thanks,

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 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
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    43 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    47 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X