I am using C++ API to automate my trades. Today my algorithm ran for SENSEX and everything was going quite well till 1:00 PM. When market suddenly started rallying, my positions went in for a loss and just like a normal day, my algo tried to exit my positions. This is where all went wrong.