Averaging take profit for multiple orders


Hello everybody,

I have a question for you:

Has anybody a code that allows me to setup a take profit based on the whole basket of buy/sell orders open?

Let me explain...

Let's say I have 1 buy order with TP se at 20 pips, the market goes against, I open another order and I need to setup the TP for both orders so that final profit will match the same profit as a the first order at 20 pips. I know it can be done letting the EA close all the order at X profit in terms of currency but what if I need to set a "physical" TP to all orders? How can I achieve the same?