Need help with OrderModify for several different Orders

 

Hey, I need some help...


to modify the Takeprofit of all the SELL Orders with the same Magicnumber and of course also of all the BUY Orders with the same Magicnumber –

for that I need all the Openprices of all the executed Orders to calculate the Takeprofit so, that it is 3 pips better than the breakevenpoint of all the SELL Orders with the same Magicnumber together.



- have 3 different rules to open an Order for SELL and 3 different for BUY

- so we can have 6 different open Entryorders at the same time



if (rule_1_short == ok ) OrderSend(Symbol(),OP_SELL,lots_Entry,Bid,3, Stop_Short_1, Bid - TP_sys_1*Point,Symbol()+"Entry_1",Magicnumber_sys_1,0,Red);

if (rule_2_short == ok ) OrderSend(Symbol(),OP_SELL,lots_Entry,Bid,3, Stop_Short_2, Bid - TP_sys_2*Point,Symbol()+"Entry_2",Magicnumber_sys_2,0,Red);

if (rule_3_short == ok ) OrderSend(Symbol(),OP_SELL,lots_Entry,Bid,3, Stop_Short_3, Bid – TP_sys_3*Point,Symbol()+"Entry_3",Magicnumber_sys_3,0,Red);


if (rule_1_long == ok ) OrderSend(Symbol(),OP_BUY,lots_Entry,Ask,3, Stop_Short_1, Ask + TP_sys_1*Point,Symbol()+"Entry_1",Magicnumber_sys_1,0,Blue);

if (rule_2_long == ok ) OrderSend(Symbol(),OP_BUY,lots_Entry,Ask,3, Stop_Short_2, Ask + TP_sys_2*Point,Symbol()+"Entry_2",Magicnumber_sys_2,0,Blue);

if (rule_3_long == ok ) OrderSend(Symbol(),OP_BUY,lots_Entry,Ask,3, Stop_Short_3, Ask + TP_sys_3*Point,Symbol()+"Entry_3",Magicnumber_sys_3,0,Blue);



- what I´m asking for is to realize this idea …


if a trade runs into minus, I want to open a new Order in the same direction and modify the Stoploss and the Takeprofit of the first Order and place the new Order Takeprofit so, that both Orders have now a Takeprofit that is 3 pips better than the breakevenpoint of both Orders..


for instance → ( if the OpenPrice of the first Order - Bid is bigger than 20 pips )


the same then for the third order, if the 2 open Orders don´t reach the breakeven and open a new order and modify ( if the OpenPrice of the second Order - Bid is bigger than 20 pips )

place the new Order Takeprofit so, that the 3 Orders have now a Takeprofit that is 3 pips better than the breakevenpoint of these 3 Orders..


the Problem is I have to programm this „idea“ for all 6 Entry rules so that the Expert Advisor takes care of all the opened Entryorders and also of the opened „Second-orders“ and always modifies the TP and SL if a new Order with the same Magicnumber and Direction is opened


thanks in advance

Reason: