You can control this behavior using the Hedge flag. The default is that opening a trade in an opposite direction, regardless of the algo, causes the open trade to close. You can control this so that only the same algo will close trades in the opposite direction, or you can allow full hedging.