Requirement: Use a specific clientId, ALWAYS the same. You will then only request orders which were issued by your client and not others.
Spend your time in extending the broker to retrieve open orders upon connecting to the server.
And then match the open orders and current position against your record of open orders and current position.
You need to take the open position into account, because orders are tied to the specific clientId, but a position is general.