1. If an overfill was detected on any order, I want to close out my entire position.
2. If any error other than order rejection occurs, I also want to close out my entire position.
To do these, of course I need accurate information for what my position is when I try to close it. What I experienced today was that StopCancelCloseIgnoreRejects gave the wrong information about my position and ended up reversing my position before I noticed and had to manually close.
So, please provide some sample code for how to handle any orders and overfills. I want to make sure that no error conditions fall through the cracks and leave me with an unintended open position.

Comment