something wrong cause "Stopline" moving, I have spent much time to get this bug, but failed

 

The codes are as below:

I just want to send an order to buy and then set a proper stopline for this order; but I find when this EA is executed, the stopline is up and down continually, so which bug cause this?

int counted=0;

int Move_Stop_Small=30,Move_Stop_Big=100;
double Get_High,Get_Low;
bool Stop_Big=false;

int start()
  {
  if(counted<1)  { counted++;OrderSend(Symbol(),OP_BUY,1,Ask,3,0,0,0,0,0,0);   }
  Move_Stop_Loss();
  return(0);
  }
  
 void Move_Stop_Loss()
{
  int i=OrdersTotal();
  if(i==0) {Stop_Big=false; return(0);}
  else
  while(i>=0)
  {
   if(OrderSelect(i-1,SELECT_BY_POS,MODE_TRADES))
   if(OrderType()==OP_BUY&&Close[0]-OrderStopLoss()>(Move_Stop_Small+5)*Point) 
   {
     if(OrderProfit()<=200*Point&&Stop_Big==false)OrderModify(OrderTicket(),OrderOpenPrice(),Close[0]-Move_Stop_Small*Point,0,0,0);
     else if(OrderModify(OrderTicket(),OrderOpenPrice(),Close[0]-Move_Stop_Big*Point,0,0,0)) Stop_Big=True;    
   } 
   i--;
  }
  return(0);
}
 

Ok

I know I have get this bug.

 
You need to check your code and search google before posting. These days you start so many threads that you didn't need to.
 
alladir:
You need to check your code and search google before posting. These days you start so many threads that you didn't need to.


Sorry if give you any trouble and thanks for your suggestion.

I post any thread just because I can't resolve it by other method.

 
vx0532: but I find when this EA is executed, the stopline is up and down continually, so which bug cause this?
rderModify(OrderTicket(),OrderOpenPrice(),Close[0]-Move_Stop_Big*Point,0,0,0)

Which is exactly what you programmed. Close[0] moves up and down continually so so does your stop.
Reason: