On the Interactive Brokers Java API, I am trying to submit an order parent, with a trailing stop child. Right now I can place one or the other, but not both. How can I submit them both together, at the same time? Am I supposed to create an array and then place order?
public void sendOrder(String orderSide, int parentOrderId) {
    System.out.println("sendOrder is called");
    Order order = new Order();
    parentOrderId = nextOrderID + 1;
    order.orderId(nextOrderID + 1);
    //order.m_action = "BUY";
    order.action(orderSide);
    //order.m_totalQuantity = 1;
    order.totalQuantity(20000);
    //order.m_lmtPrice = 0.01;
    System.out.println("sendOrder, this.high = " + this.high);
    DecimalFormat df = new DecimalFormat("0.00000"); // TODO get digit according
    String formatedEntryPrice = df.format(this.high);
    System.out.println("formatedEntryPrice = " + formatedEntryPrice);
    order.lmtPrice(Double.valueOf("1.00")); // TODO stop limit at prior day high
    //order.auxPrice(this.high);
    //order.auxPrice(Double.valueOf(formatedEntryPrice));
    //order.m_orderType = "LMT";
    order.orderType("LMT");
    //order.m_account = "U1836253";
    order.account("U1836253");
  order.transmit(false);
    System.out.println("after creating order");
     if (orderSide  == "BUY"){
         Order stopLoss = new Order();
          order.action ("SELL");
        stopLoss.orderId(nextOrderID + 1);
        order.orderType ("TRAIL");
        order.totalQuantity (20000);
        order.trailingPercent (1);
        order.trailStopPrice(low);
        stopLoss.parentId(nextOrderID) ;
         order.transmit(true);
     }
     if (orderSide  == "SELL"){
         Order stopLoss = new Order();
          order.action ("BUY");
        stopLoss.orderId(nextOrderID + 1);
        order.orderType ("TRAIL");
        order.totalQuantity (20000);
        order.trailingPercent (1);
        order.trailStopPrice(low);
        stopLoss.parentId(nextOrderID) ;
         order.transmit(true);
     }
    m_s.placeOrder(nextOrderID + 1, contract, order);
    System.out.println("sendOrder is finished");
    nextOrderID = nextOrderID +1;
    client.reqIds(Integer.valueOf("1"));
    System.out.println("sendOrder is finished 2");
}
 
    