What is the proper method to simulate a Market On Close order when trading live with IB?

Imagine you want to go long the last 15 minutes of market time on an asset, when market closes at 1600.

On time==1545 I use a simple,
enterLong()

On time==1546 I use the below and set the MOC OrderText.
if (is(TRADEMODE))
{
brokerCommand(SET_ORDERTYPE,2);
brokerCommand(SET_ORDERTEXT,"MOC/");
exitLong();
}

This properly sends a market on close order that is correctly executed on the broker side by IB. The trade is opened at 1545, and exited on market close at 1600.

However in Zorro the trade is effectively closed immediately when the MOC order is sent, and the TradeExit price is set, at 1546. This makes the trade statistics useless while in trading mode.

While backtesting this is no problem, you can just wait for the last bar in market time and use exitLong().