Trouble with Trade Functions - page 2 12 New comment Mladen Rakic 2014.10.02 21:05 #11 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 Barry Weinberg 2014.10.02 21:12 #12 Does the Magic Number of a Pending Order stay the same when it is opened? Barry Weinberg 2014.10.02 21:13 #13 Can you maybe give me an example of OrderModify using the Magic Number? Thanx Mladen Rakic 2014.10.02 21:18 #14 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 } } 12 New comment
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
Can you maybe give me an example of OrderModify using the Magic Number? Thanx
Try something like this :
{
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
}
}