Trouble with Trade Functions - page 2

 
ThemBonez:
so then, how does one modify a stoploss on such an order?

You select an order based usually on magic number, symbol and type and then you do the necessary modifications

 

Does the Magic Number of a Pending Order stay the same when it is opened?

 

Can you maybe give me an example of OrderModify using the Magic Number?

Thanx

 
ThemBonez:
Can you maybe give me an example of OrderModify using the Magic Number? Thanx

Try something like this :

for(int cnt=OrdersTotal()-1; cnt>=0;cnt--)

{

if (!OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) continue;

if (OrderSymbol() != Symbol()) continue;

if (OrderMagicNumber()!= MagicNumber) continue;

if (OrderType() == OP_BUY)

{

// code for buy order modification

}

if (OrderType() == OP_SELL)

{

// code for sell order modification

}

}