Bracket Orders
Adding take profit and stop loss levels or TP/SL OCO bracket to an alert is very simple and is only available as part of the PLACE
order command. Both fields accept numeric values only that represent price level triggers for the order in the underlying.
One-sided TP/SL Order
When CrossTrade receives a request for either take_profit
or stop_loss
inside of a place order message, it creates an opposing order (buy becomes sell and vice versa, same quantity, etc.).
take_profit
becomes a buy or sell limit order to guarantee the profit target is hit, while stop_loss
becomes a buy or sell stop market order. Both orders are entered as GTC (Good-til-Canceled).
Two-sided TP/SL OCO Bracket Order
If both take_profit
and stop_loss
are included in the alert message, it will automatically become an independent OCO bracket order. If the position is closed by means other than the take profit or stop loss orders, the bracket remains active.
Appending to an ATM Strategy
It's possible to append take_profit
and/or stop_loss
to an ATM strategy for management. To do so, you must indicate the strategy
name with the optional flag append_atm=true;
This will move the TP/SL order(s) under the ATM strategy for management. If the position or strategy is closed, all related positions and orders will be closed or canceled.
Example Payloads
Generic market order with take profit level set:
key=your-secret-key; command=PLACE; account=sim101; instrument=NQ 12-24; action=BUY; qty=1; order_type=MARKET; TIF=DAY; take_profit=(price above);
Market order with both a take profit and stop loss level set, which gets converted into an OCO bracket automatically:
key=your-secret-key; command=PLACE; account=sim101; instrument=NQ 12-24; action=BUY; qty=1; order_type=MARKET; TIF=DAY; take_profit=(price above); stop_loss=(price below);
Finally, a market order with TP/SL OCO bracket order appended to an ATM strategy called "crosstrade":
key=your-secret-key; command=PLACE; account=sim101; instrument=NQ 12-24; action=BUY; qty=1; order_type=MARKET; TIF=DAY; take_profit=(price above); stop_loss=(price below); strategy=crosstrade; append_atm=true;
Last updated