Note: I do not reuse any order names.
New order:
TSLA Buy market order name TSLA123
TSLA StopMarket order name TSLA100 with order OCO name TSLA123
TSLA Limit order name TSLA200with order OCO name TSLA123
Stop or limit order rejected because its at market price... <-------- IMPORTANT TO EXPOSE THE BUG
New order:
TSLA Buy market order name TSLA456
TSLA StopMarket order name TSLA300 with order OCO name TSLA456
TSLA Limit order name TSLA400 with order OCO name TSLA456
Error order OCO name TSLA123 cannot be reused
New order:
TSLA Buy market order name TSLA789
TSLA StopMarket order name TSLA500 with order OCO name TSLA789
TSLA Limit order name TSLA600 with order OCO name TSLA789
Error order OCO name TSLA123 cannot be reused
All my tied OCO orders work fine. This bug starts when the stop or limit order is rejected because it's at market price (or above or below depending if its a stop or limit order) .
To recreate the bug you must set a stop or limit order with an OCO name matching a market order... the stop or limit order must be at market price to get rejected (very realistic scenario in a fast moving market)... then submit a new order for the same instrument using new order names and new matching order OCO names and you'll see it keeps using the old OCO name.
The only way to temporarily fix it is to reset the account. I verified this behavior on two separate machines running NinjaTrader using two different ways... through a NinjaScript Strategy and through a NinjaScript AddOn.

Comment