ORDERCLOSEBY Function
I added that code to my EA to close an existing trade when the opposite signal occurs and also take the trade in the opposite direction. The problem is that the code only the direction of the first signal it receives i.e. if the first signal is a sell, it will only take sell signals and vice versa.