Yes, it is possible to add a closing Market order as the third leg of a Bracket order. In Classic TWS, first create a Bracket order consisting of a Parent order with an attached One Cancels All (OCA) group that has both a Profit Taking Limit order and a Stop Loss order. Next, right click on the Parent order and attach a new Limit order that is now the third OCA leg of your Bracket order. To make it a closing Market order, change the order type of the newly attached order to MKT. To ensure that this order becomes active before the start of the Reg T check period or before the end of the RTH session you will need to add a Time condition. Right click on the MKT order line and select Modify followed by Condition. Click the Add button, choose the Time option, edit your time parameters (make the MKT order active a few minutes before the 15:50 EST start of the Reg T check period or before the 16:00 EST RTH close} then click Finish. Once you have done this, click Transmit to submit the order.
For more information on setting a time condition, please visit our IBKR Short Videos