Partial close - Help needed

 

Hi all,

I want to implement a partial close function, the order should be closed partially when it reaches some pips in profit.

What I have doubts is how to know when the order has already been closed partially, for example:

-Buy order, open price 1.5000, close 50% at 50 pips of profit.

-The price reachs 1.5050, so ea closes 50%.

-Next tick comes in 1.5051, order should not be partially closed again, how to determine this?

A possible solution is setting SL in BE after the partial close, but I prefer to manage BE independently of the partial close, so it is not a valid solution.

Also, a simple flag does not work because it should be used with multiple opened orders.

Any idea will be appreciatted!

Happy new year!!

 

use internal flags, if you need to manage multiple orders you may need an array of flags..


//z