Modify an Order

 

hi guys.

am new to programming and have been playing around with MQL4. i seem to be hitting a wall with the code. am trying to have an order modified when condition "A" happens. however it does not to work. below is how my code would look like.



double stopLoss;

if(a>b)
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=XXXX || OrderSymbol()!=Symbol()) continue;

if(OrderType()==OP_BUY)

if(OrderStopLoss()<y)
stopLoss=z;

OrderModify(OrderTicket(),OrderOpenPrice(),stopLoss,OrderTakeProfit(),0,Blue);
return(0);

}

could someone help me. thank you in advance

 

Try this - bit of a guess on the context but might get you going!

double stopLoss;

if(a>b)
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if((OrderMagicNumber()=XXXX) && (OrderSymbol()=Symbol())) continue;

if(OrderType()==OP_BUY)
  {
   if(OrderStopLoss()<y) stopLoss=z;

   OrderModify(OrderTicket(),OrderOpenPrice(),stopLoss,OrderTakeProfit(),0,Blue);
   return(0);
  }

}

Good Luck

-BB-