Wondered if I can get a little help with this: I am developing a automated order ex application which enters trades MOO and closes them MOC. Protective stops are generated as I get filled a few minutes after the open. At the same time MOC orders are sent to flatten all positions at the close. Today, while in simulation mode, I was short XRT, the protective stop was touched a few minutes before the close, since the stop occurred during the period when MOC cannot be cancelled, would I have ended up long with the MOC order?, forcing me to a sell long in the after hour to get flat. Any suggestions on how I can offset this potential problem?