I tried to describe possible scenario, maybe I just need to add more details.
Problem: Long position opened with SL / TP, then I open Short position of the same volume, result - positions compensate each other, so I don't have positions at all, but SL / TP orders are still active. OCO cancel orders, so OCO can detect when order gets filled / invalid / cancelled, but in my case initial market order will be closed by NEW UNRELATED POSITION. So, I need some mechanism to define connection between the first 3 orders (Market, SL, TP) and new order that will remove initial market order. Link in the post describes how to deal with 3 orders, it doesn't answer how to cancel existing orders when OCO relations are already defined.