API not the problem TWS is only capable of 50 messages per second I placed over 500 orders and it tripped on a 504 connection error I had 180 messages a second according to IB Support
Findings TWS can only handle 50 messages a second from the API
I fixed my MOC by reducing the universe and increased the trades using switching on the buy limit.
MOC – -2%
MR – -3%
Had problem where the API where MOC didn’t go through couple of days ago but on that day I had played with preference tab after I sent the orders to TWS
I made sure to set the preference before sending the orders seems to be the solution