Add pending order to existing open order

 
Hi,

What is the code if I want to put one buystop order and one sellstop order for any open trades that I opened manually (or by another EA)? I trade multiple currency pairs so I need an EA that just sit on my MT4, wait for any open trades (any symbol), then add/open the pending orders.

Thank in advance.
 
 
eacombi:
Hi,

What is the code if I want to put one buystop order and one sellstop order for any open trades that I opened manually (or by another EA)? I trade multiple currency pairs so I need an EA that just sit on my MT4, wait for any open trades (any symbol), then add/open the pending orders.

Thank in advance.
double SpreadA = (Ask - Bid);


double M=((Bid+SpreadA)+1*Point)



TakeTPB = (Bid+15*Point);


Order = OrderSend(Symbol(),OP_BUYLIMIT,Lot,M,2,0,TakeTPB);
That is one point not one pip
These are the rules for orders opening prices :
Order TypeOpen PriceClose PriceOpen Price of a Pending OrderTransforming a Pending Order into aMarket Order
Buy
Ask
Bid
Sell
Bid
Ask
BuyLimit
Below the current Ask priceAsk price reaches open price
SellLimit
Above the current Bid priceBid price reaches open price
BuyStop
Above the current Ask priceAsk price reaches open price
SellStop
Below the current Bid priceBid price reaches open price