Server-side OCO bracket with strategy

benjcal

Member
Joined
Nov 29, 2024
Posts
9
Likes
3
Hello everyone!

I'm trying to place an OCO order with a custom strategy I'm working on.

The code to place the orders looks like this:

Order entry = ctx.createMarketOrder(Enums.OrderAction.BUY, qty);
Order stopLoss = ctx.createStopOrder(Enums.OrderAction.SELL, Enums.TIF.GTC, qty, stopPrice);
Order takeProfit = ctx.createLimitOrder(Enums.OrderAction.SELL, Enums.TIF.GTC, qty, tpPrice);

ctx.submitOrders(entry, stopLoss, takeProfit);

I asked Motivewave support and they said that if the server supported it the orders would be automatically submitted as OCO, and that both CQG and Rithmic supported server-side OCO.

The thing is that I've been testing this and if I place orders with the code above and close the platform, when either the stop loss or profit orders are triggered the other IS NOT cancelled!

The way in which I've been checking this is by letting the strategy place the three orders above, closing motivewave and the login into CQG mobile app. And indeed, when either the profit or stop gets triggered the other order IS NOT cancelled.

Does anybody has any experience with this? am I submitting those orders incorrectly?

Thanks for the help!
 
Top