if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
{
sellstop=OrderSend(Symbol(),OP_SELLSTOP,Lots,NormalizeDouble(OrderOpenPrice()-50*point,digits),3,0,0,"try2 sample",magic,0,Green);
selllimit=OrderSend(Symbol(),OP_SELLLIMIT,Lots,NormalizeDouble(OrderOpenPrice()+50*point,digits),3,0,0,"try2 sample",magic,0,Red);
can anybody teach me how to manage two pending order? i want sent two pending orders when first order performed. how to manage these pending order? somebody suggest to changes in the magic number of the pending orders,and carry out this purpose.but how to do that? i m not really understand .pls teach me how to write this program if you know.thanks
Hello wang
I suspect that you want to open the sell orders so they are stop-loss and take profit levels for the first buy order. If this is so, then it will not work. Each new pending order will open a new position in addition to the existing buy order. In order to set up a stop-loss and take profit for an order it is done in either of two ways.
1. Set the stop-loss and take profit levels in the original OrderSend(). You just have to make sure that the levels are more than the StopLevel away from the current price.
2. Use OrderModify() to set the stop-loss and take profit levels in a similar way.
Cheers
Jellybean
Hello wang
I suspect that you want to open the sell orders so they are stop-loss and take profit levels for the first buy order. If this is so, then it will not work. Each new pending order will open a new position in addition to the existing buy order. In order to set up a stop-loss and take profit for an order it is done in either of two ways.
1. Set the stop-loss and take profit levels in the original OrderSend(). You just have to make sure that the levels are more than the StopLevel away from the current price.
2. Use OrderModify() to set the stop-loss and take profit levels in a similar way.
Cheers
Jellybean
hi jellybean
thank you so much. Exactly! as you said that i was trying to do.
thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
{
sellstop=OrderSend(Symbol(),OP_SELLSTOP,Lots,NormalizeDouble(OrderOpenPrice()-50*point,digits),3,0,0,"try2 sample",magic,0,Green);
selllimit=OrderSend(Symbol(),OP_SELLLIMIT,Lots,NormalizeDouble(OrderOpenPrice()+50*point,digits),3,0,0,"try2 sample",magic,0,Red);
can anybody teach me how to manage two pending order? i want sent two pending orders when first order performed. how to manage these pending order? somebody suggest to changes in the magic number of the pending orders,and carry out this purpose.but how to do that? i m not really understand .pls teach me how to write this program if you know.thanks