Closing Positions through Fix messages

Imported from previous forum

I am developing trading plateform in which client send new order, after receiving fill order, the client send close order.My problem is how i recognize that the order request is to close order so that prfit calculation process can be done.
For example.What will be ordtype?etc

There are two scenarios

  1. The Order is completely filled. In this case there is nothing more left in the order to execute, so your system can start the profit-loss calculations

  2. The order is partially filled and your client does not wish any more execution of the leaves quantity. In this case, the client would send Message Type 35=F Order Cancel Request. Your system would send an ExecReport with OrdStatus 39=4 Canceled and then your system can start the profit-loss calculation

I am developing trading plateform in which client send new order, after
receiving fill order, the client send close order.My problem is how i
recognize that the order request is to close order so that prfit
calculation process can be done. For example.What will be ordtype?etc