recovered the stop of the first line

 
hello,

I have a rebot takes 6 positions. I wish all of my lines is the same stop must be the stop of my line 1 which is with 0.01 lot

For example here is my online purchase

OrderSend(Symbol(),OP_BUY,ldLot,NormalizeDouble( Ask ,Digits), Slippage ,Bid-300*Point,ldTake,lsComm,iMagic,0,NULL);

I made this code to manage the same stop on any lines but its not working

can you help me?

thank you


   // buy
    for(i = 0 ; i <= 1 ; i++)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderLots()==0.01)
      {
    newstop=0;
    newstop=OrderStopLoss();
      }
      }


 for(i=0;i<OrdersTotal();i++)
      {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderType()==OP_BUY )
      {
        OrderModify(OrderTicket(),OrderOpenPrice(),newstop,OrderTakeProfit(),0,Green);
         return(0);
      }
      }    

for(i = 0 ; i <= 1 ; i++) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderComment()==Name_Expert && OrderType()==OP_BUY && OrderLots()==0.01) { newstop=0; newstop=OrderStopLoss(); } } for(i=0;i<OrdersTotal();i++) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderComment()==Name_Expert && OrderType()==OP_BUY ) { OrderModify(OrderTicket(),OrderOpenPrice(),newstop,OrderTakeProfit(),0,Green); return(0); } } - See more at: http://www.forexagone.com/forum/expert-advisors-robots/modification-ea-ligne-stop-18320#99912
 
// you may need something this

... if (OrderStopLoss() < newstop) newstop=OrderStopLoss(); ...

newstop=0; preceding another newstop=... line is redundant.