Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OCO name keeps being reused?
Collapse
X
-
Hello defa0009,
The errors you are seeing is just a side effect of the rejection, if 1 of 2 orders gets rejected the second order will be rejected for reusing the OCO because that was already used for the rejected order. That is normal, you would need to fix the issue of the order being rejected instead of focusing on the OCO.
If you see the errors go away when resetting the account you may indeed be using a non unique string for the OCO id, you can use the following for an always unique id.
string atmStrategyId = GetAtmStrategyUniqueId();
-
Hello defa0009,
You placed an order that got rejected with that OCO, so its been used at that point, you would have to come up with a totally new OCO for any future orders,
I would suggest using the GetAtmStrategyUniqueId method, that ensures an always unique id is created for any new orders going forward. An OCO is considered used if any order, realtime or historical has ever used that ID so it is important to use a method which cannot re use any of the same terms to avoid reusing ids.
Comment
-
Hello defa0009,
I can only suggest to use the known working methods like GetAtmStrategyUniqueId to make sure that you are generating unique ID's, from your description it sounds like you have a flaw in the logic of that script which is causing ids to be reused.
While I cant tell what you may be doing incorrectly in your script you can see the following sample which generates OCO tied orders.
Keep in mind if your target gets rejected its normal to see the OCO reused error, in that case that is normal because part of the OCO tied pair was rejected so the other order will also be rejected saying its OCO has been reused.
Comment
-
Hello defa0009,
I would suggest testing using the sample that I had linked, that script is known to be working and correctly utilizes OCO strings.
I cannot estimate what problem you may have in your script but I can suggest looking at something which is already working, that can help to identify what is happening when your script is reusing the OCO id's.
In regard to reporting bugs, if you find something which is unexpected you can report that on the forum but you will need to provide a working example script that demonstrates the problem. Our support team is unable to create scripts based on a description but we can review simplified examples that you create which explicitly shows an issue. When making a sample to demonstrate an issue make sure that the only code present in the file is what is required to execute the script and see the issue one time. For example you could make a script that submits 1 entry in realtime and then recreates the issue. Based on that I can check if you are correctly using OCO and if not make a suggestion about how to correctly use OCO.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
557 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment