I'm placing my order after an if statement as shown above. I want to place an exit order along with it so that when the order gets triggered then a stop loss is automatically get placed.
If you place a cover order, the system will take care of placing the second leg order. You don't have to explicitly place another order.
The order place response will give you an order id which is the parent order id of the second leg order. You need to fetch orderbook and find the order which has parent order id same as the one received.
The order place response will give you an order id which is the parent order id of the second leg order. You need to fetch orderbook and find the order which has parent order id same as the one received.