how do i stop my ea from opening order right after the stoploss it hit - page 2

 
qjol:

can u explain what is the purpose of this code:


that code was to make it wait for the next signal after the close of an order
 

you can skype me at: hustlerscreed

 
extern double LotSize=0.1;
extern int SL=50,
           TP=30;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   if(Digits==3 || Digits==5)
    {
     SL*=10;
     TP*=10;
    }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//double mfi=iMFI( NULL, 0, 20,0); 
//double ma=iMA(NULL,0, 14, 0, 0, 0, 0); 
double macd11=iCustom(Symbol(),0,"macd6",10,26,1,0,2);
double macd21=iCustom(Symbol(),0,"macd6",10,26,1,1,2);

if (macd21==0 && TOOC()==0 && NewBar()){OrderSend(Symbol(),OP_BUY,LotSize,Ask,0,0,0,NULL,0,0,Green);}
if (macd11==0 && TOOC()==0 && NewBar()){OrderSend(Symbol(),OP_SELL,LotSize,Bid,0,0,0,NULL,0,0,Red);}
//----

   SetSLTP();
//----
   return(0);
  }
//+------------------------------------------------------------------+

int TOOC()
{
  int tooc;
  for(int a=0;a<OrdersTotal();a++) 
   if(OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==true)
    if(OrderSymbol()==Symbol())
      tooc++;
  return(tooc);
}

void SetSLTP()
{
  for(int a=0;a<OrdersTotal();a++)
   if(OrderSelect(a,0,0))
    if(OrderSymbol()==Symbol())
     {
      if(OrderType()==OP_BUY)
       {
        RefreshRates();
        if(OrderStopLoss()==0)OrderModify(OrderTicket(),OrderOpenPrice(),Bid-SL*Point,OrderTakeProfit(),0,Yellow);
        RefreshRates();
        if(OrderTakeProfit()==0)OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),Bid+TP*Point,0,Yellow);
       }
      if(OrderType()==OP_SELL)
       {
        RefreshRates();
        if(OrderStopLoss()==0)OrderModify(OrderTicket(),OrderOpenPrice(),Ask+SL*Point,OrderTakeProfit(),0,Yellow);
        RefreshRates();
        if(OrderTakeProfit()==0)OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),Ask-TP*Point,0,Yellow);
       }
     }
  return;
}

bool NewBar () 
   {
   static datetime LastTime = 0;

   if (Time[0] != LastTime)
      {
      LastTime = Time[0];     
      return (true);
      }
   else
      return (false);
   }