Issue with Stop-Loss on Multiple Stock Datas
There is no need for logic there and that's why there is none. The entry order (aka main side) is protected automatically with a stop-loss side and a take-profit side (the high/low side depends on the direction entry), which are only active if the entry order is executed.
Once the stop-loss/take-profit sides become active, the execution of any of them automatically cancels the other.
If you decide to exit the market with an unrelated order, you have to manually cancel any of the sides (the other will be cancelled automatically) as in
self.cancel(order_stop_loss_side) # this automatically cancels the take-profit side too