i did not reopen tickets if it is close on be

 
//+------------------------------------------------------------------+
//|                                     Reverse_Grid_Martingale .mq4 |
//|                              Copyright � 2014, AMIT           |
//|                                                                 |
//+------------------------------------------------------------------+
#property copyright "Copyright � 2014, AMIT"


extern bool LongOnly=true;
extern bool ShortOnly=true;
extern double stopStepSizeInPips=300;


extern bool turnOn=true;
extern double limitStepSizeInPips=300;
extern int MagicNumber=1000;//stop
extern int MaxSlippage=5;
extern int wait=0;
extern double buyloss=0;
extern double sellloss=0;


extern double r=0;
extern double TrailingStop = 50; 
extern double StopLoss =0; 
extern double buystopStepSizeInPips=300;
extern double sellstopStepSizeInPips=300;


  
extern double X=600;

int ticket1,ticket2,ticket3,ticket9,ticket10,ticket11,ticket12,ticket13,ticket14,ticket15,ticket16,ticket17,ticket18,ticket19,ticket20,ticket21,ticket22,ticket23,ticket24,ticket25,ticket26,ticket27,ticket28;


extern int BUYSTOP=1;
extern int SELLSTOP=1; 
extern double LotSize1  =0.01;
extern double LotSize2  =0.02;
extern double LotSize3  =0.03;
extern double LotSize4  =0.04;
extern double LotSize5  =0.05;
extern double LotSize6  =0.06;
extern double LotSize7  =0.07;
extern double LotSize8  =0.08;
extern double LotSize9  =0.09;
extern double LotSize10 =0.10;
extern double LotSize11 =0.11;
extern double LotSize12 =0.12;
extern double LotSize13 =0.13;
extern double LotSize14 =0.14;
extern double LotSize15 =0.15;
extern double LotSize16 =0.16;
extern double LotSize17  =0.17;
extern double LotSize18  =0.18;
extern double LotSize19 =0.19;
extern double LotSize20 =0.20;
extern double LotSize21 =0.21;
extern double LotSize22 =0.22;
extern double LotSize23 =0.23;
extern double LotSize24 =0.24;
extern double LotSize25 =0.25;
extern double LotSize26 =0.26;
extern double LotSize27 =0.27;
extern double LotSize28 =0.28;
extern double LotSize29 =0.29;
extern double LotSize30 =0.30;
extern double LotSize31 =0.31;
extern double LotSize32 =0.32;
extern double LotSize33  =0.33;
extern double LotSize34 =0.34;
extern double LotSize35 =0.35;
extern double LotSize36 =0.36;
extern double LotSize37 =0.37;
extern double LotSize38 =0.38;
extern double LotSize39 =0.39;
extern double LotSize40 =0.40;
extern double LotSize41 =0.41;
extern double LotSize42 =0.42;
extern double LotSize43 =0.43;
extern double LotSize44 =0.44;
extern double LotSize45 =0.45;
extern double LotSize46 =0.46;
extern double LotSize47 =0.47;
extern double LotSize48 =0.48;
extern double LotSize49 =0.49;
extern double LotSize50 =0.50;

double LotSizes[51];

int openLongs,openShorts;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------*


 int init() 



{LotSizes[1]=LotSize1;
LotSizes[2]=LotSize2+r;
LotSizes[3]=LotSize3+r;
LotSizes[4]=LotSize4+r;
LotSizes[5]=LotSize5+r;
LotSizes[6]=LotSize6 +r;
LotSizes[7]=LotSize7+r;
LotSizes[8]=LotSize8  +r;
LotSizes[9]=LotSize9  +r;
LotSizes[10]=LotSize10 +r;
LotSizes[11]=LotSize11+r;
LotSizes[12]=LotSize12+r;
LotSizes[13]=LotSize13+r;
LotSizes[14]=LotSize14 +r;
LotSizes[15]=LotSize15+r;


LotSizes[16]=LotSize16+r;
LotSizes[17]=LotSize17+r;
LotSizes[18]=LotSize18+r;
LotSizes[19]=LotSize19+r;
LotSizes[20]=LotSize20+r;
LotSizes[21]=LotSize21+r;
LotSizes[22]=LotSize22+r;
LotSizes[23]=LotSize23 +r;
LotSizes[24]=LotSize24 +r;
LotSizes[25]=LotSize25 +r;
LotSizes[26]=LotSize26+r;
LotSizes[27]=LotSize27+r;
LotSizes[28]=LotSize28+r;
LotSizes[29]=LotSize29 +r;
LotSizes[30]=LotSize30+r;


LotSizes[31]=LotSize31+r;
LotSizes[32]=LotSize32+r;
LotSizes[33]=LotSize33+r;
LotSizes[34]=LotSize34+r;
LotSizes[35]=LotSize35+r;
LotSizes[36]=LotSize36 +r;
LotSizes[37]=LotSize37+r;
LotSizes[38]=LotSize38  +r;
LotSizes[39]=LotSize39  +r;


LotSizes[40]=LotSize40 +r;
LotSizes[41]=LotSize41 +r;
LotSizes[42]=LotSize42+r;
LotSizes[43]=LotSize43+r;
LotSizes[44]=LotSize44 +r;
LotSizes[45]=LotSize45+r;



LotSizes[46]=LotSize46 +r;
LotSizes[47]=LotSize47+r;
LotSizes[48]=LotSize48  +r;
LotSizes[49]=LotSize49  +r;
LotSizes[50]=LotSize50 +r;

Print("**** starting up");
return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
static int count=0;


    

if (count == 0) {
 if(LongOnly) 
 
 
  ticket1 = 0;
         ticket2 = 0;
         ticket9 = 0;
         ticket10 = 0;
         ticket11 = 0;
         ticket12 = 0;
         ticket13 = 0;
         ticket14 = 0;
 
 
 
 
 
 if(ShortOnly)
 
 
 
 
  ticket1 = 0;
         ticket2 = 0;
         ticket15 = 0;
         ticket16 = 0;
         ticket17 = 0;
         ticket18 = 0;
         ticket19 = 0;
         ticket20 = 0;
        
     
  count++;} 








check();{
{
  double PointValue; {int i2 = 0; for(i2 = OrdersTotal()-1; i2 >= 0; i2--)//  int i2 = 0;
  // for(i2 = 0; i2 >= OrdersTotal()-G1; i2++)//

  {
      OrderSelect(i2, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() != Symbol()) continue; // Skipping positions in other currency pairs
      //Calculate the point value in case there are extra digits in the quotes
      if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.00001) PointValue = 0.00001;
      else if (MarketInfo(OrderSymbol(), MODE_POINT) == 0.001) PointValue = 0.001;
      else PointValue = MarketInfo(OrderSymbol(), MODE_POINT);
      //Normalize trailing stop value to the point value
      double TSTP = TrailingStop * PointValue;
 
 
if (turnOn==true){
      if ((OrderType() == OP_BUY)&& (OrderMagicNumber() == MagicNumber))
         {
          
         if (Bid - OrderOpenPrice()-X* PointValue > TSTP)
         {
            if (OrderStopLoss() < Bid - TSTP -X* PointValue   )
            {
               if (!OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + TSTP, OrderTakeProfit(), Red))
                  Print("Error setting Buy trailing stop: ", GetLastError());
            }
         }
         else if ((OrderStopLoss() != Bid -X* PointValue - StopLoss * PointValue) && (StopLoss != 0) && (OrderStopLoss() == 0))
            if (!OrderModify(OrderTicket(), OrderOpenPrice(),  OrderOpenPrice() + StopLoss * PointValue, OrderTakeProfit(), Red))
               Print("Error setting Buy stop-loss: ", GetLastError());
      }
      else if ((OrderType() == OP_SELL)&& (OrderMagicNumber() == MagicNumber))
      {
         if (OrderOpenPrice() - Ask-X* PointValue > TSTP)
         {
            if ((OrderStopLoss() > Ask +X* PointValue+ TSTP) || (OrderStopLoss() == 0))
            {
               if (!OrderModify(OrderTicket(), OrderOpenPrice(),OrderOpenPrice() - TSTP, OrderTakeProfit(), Red))
                  Print("Error setting Sell trailing stop: ", GetLastError());
            }
         }
         else if ((OrderStopLoss() != Ask+X* + StopLoss * PointValue) && (StopLoss != 0) && (OrderStopLoss() == 0))
            if (!OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - StopLoss * PointValue, OrderTakeProfit(), Red))
               Print("Error setting Sell stop-loss: ", GetLastError());}}}}
  }
  }
  
//+------------------------------------------------------------------+


//int ticket1,ticket2,ticket3,ticket4,ticket5,ticket6,ticket7,ticket8,ticket9,ticket10,ticket11,ticket12,ticket13,ticket14,ticket15,ticket16,ticket17,ticket18,ticket19,ticket20,ticket21,ticket22,ticket23,ticket24,ticket25,ticket26,ticket27,ticket28;
//ticket1
           { if(ticket1==0)ticket1 = OrderSend(Symbol(),OP_BUY,LotSizes[1],Ask,MaxSlippage,0,0,"Long 1",MagicNumber,0);

            if(ticket2==0)ticket2 = OrderSend(Symbol(),OP_SELL,LotSizes[1],Bid,MaxSlippage,0,0,"Short 1",MagicNumber,0);
            
            
            
            if(ticket9==0)ticket9 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*1+BUYSTOP*1+BUYSTOP*1],NormalizeDouble(Ask+(stopStepSizeInPips*1*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*1*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP1",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket10==0)ticket10 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*2+BUYSTOP*2+BUYSTOP*2],NormalizeDouble(Ask+(stopStepSizeInPips*2*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*2*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP2",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket11==0)ticket11 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*3+BUYSTOP*3+BUYSTOP*3],NormalizeDouble(Ask+(stopStepSizeInPips*3*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*3*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP3",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket12==0)ticket12 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*4+BUYSTOP*4+BUYSTOP*4],NormalizeDouble(Ask+(stopStepSizeInPips*4*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*4*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP4",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket13==0)ticket13 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*5+BUYSTOP*5+BUYSTOP*5],NormalizeDouble(Ask+(stopStepSizeInPips*5*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*5*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP5",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket14==0)ticket14 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*6+BUYSTOP*6+BUYSTOP*6],NormalizeDouble(Ask+(stopStepSizeInPips*6*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*6*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP6",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            
            
            if(ticket15==0)ticket15 =OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*1+SELLSTOP*1+SELLSTOP*1],NormalizeDouble(Bid-(stopStepSizeInPips*1*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*1*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP1",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket16==0)ticket16 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*2+SELLSTOP*2+SELLSTOP*2],NormalizeDouble(Bid-(stopStepSizeInPips*2*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*2*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP2",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket17==0)ticket17 =OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*3+SELLSTOP*3+SELLSTOP*3],NormalizeDouble(Bid-(stopStepSizeInPips*3*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*3*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP3",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket18==0)ticket18 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*4+SELLSTOP*4+SELLSTOP*4],NormalizeDouble(Bid-(stopStepSizeInPips*4*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*4*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP4",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket19==0)ticket19 =OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*5+SELLSTOP*5+SELLSTOP*5],NormalizeDouble(Bid-(stopStepSizeInPips*5*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*5*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP5",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket20==0)ticket20 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*6+SELLSTOP*6+SELLSTOP*6],NormalizeDouble(Bid-(stopStepSizeInPips*6*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*6*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP6",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            
            
   }
 
 
 
 
 
 
 
 }
int openPositions(int type){
   int Total = OrdersTotal();
   int Long=0;int Short=0;
   int ret = -1;
   for (int i = 0; i < Total; i ++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol() == Symbol()     ) {
        if (OrderType()==OP_BUY) long;
        if (OrderType()==OP_SELL) short;}  }
return(ret);
}
   

   
void closeShorts()
{
    int Total = OrdersTotal();
    for (int i = 0; i < Total; i ++) {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderSymbol() == Symbol() && OrderMagicNumber()==MagicNumber && (OrderType()==OP_SELL   )    ) {
            OrderClose(OrderTicket(),OrderLots(),Ask,MaxSlippage);
        }
    }
}
void closeLongs()
{
    int Total = OrdersTotal();
    for (int i = 0; i < Total; i ++) {
        OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
        if (OrderSymbol() == Symbol() && OrderMagicNumber()==MagicNumber && (OrderType()==OP_BUY   )    ) {
            OrderClose(OrderTicket(),OrderLots(),Bid,MaxSlippage);
        }
    }
} 
void check()
{
     




if((openPositions(OP_BUY)<openLongs)) 
   {
   
    if(ticket11>0&&ticket9==0)ticket10 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*2+BUYSTOP*2+BUYSTOP*2],NormalizeDouble(Ask+(stopStepSizeInPips*2*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*2*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP2",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket12>0&&ticket10==0)ticket11 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*3+BUYSTOP*3+BUYSTOP*3],NormalizeDouble(Ask+(stopStepSizeInPips*3*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*3*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP3",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket13>0&&ticket11==0)ticket12 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*4+BUYSTOP*4+BUYSTOP*4],NormalizeDouble(Ask+(stopStepSizeInPips*4*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*4*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP4",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
            if(ticket14>0&&ticket12==0)ticket13 =OrderSend(Symbol(),OP_BUYSTOP,LotSizes[BUYSTOP*5+BUYSTOP*5+BUYSTOP*5],NormalizeDouble(Ask+(stopStepSizeInPips*5*Point) ,Digits),MaxSlippage,NormalizeDouble((Ask+(stopStepSizeInPips*5*Point)+(wait*Point)-(buystopStepSizeInPips*Point))*buyloss ,Digits),0,"BUY STOP5",MagicNumber,0);//NormalizeDouble(Ask+(stopStepSizeInPips*Point)-(buystopStepSizeInPips*Point)+(wait*Point),Digits)
           
   
          

   
   
   
   
   
   
   }

if((openPositions(OP_SELL)<openShorts)) 
   {
   if(ticket20>0&&ticket18==0)ticket19 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*5+SELLSTOP*5+SELLSTOP*5],NormalizeDouble(Bid-(stopStepSizeInPips*5*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*5*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP5",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
              if(ticket19>0&&ticket17==0)ticket18 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*4+SELLSTOP*4+SELLSTOP*4],NormalizeDouble(Bid-(stopStepSizeInPips*4*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*4*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP4",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
             if(ticket18>0&&ticket16==0)ticket17 = OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*3+SELLSTOP*3+SELLSTOP*3],NormalizeDouble(Bid-(stopStepSizeInPips*3*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*3*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP3",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
            if(ticket17>0&&ticket15==0)ticket16 =  OrderSend(Symbol(),OP_SELLSTOP,LotSizes[SELLSTOP*2+SELLSTOP*2+SELLSTOP*2],NormalizeDouble(Bid-(stopStepSizeInPips*2*Point ),Digits),MaxSlippage,NormalizeDouble((Bid-(stopStepSizeInPips*2*Point )-(wait*Point)+(sellstopStepSizeInPips*Point))*sellloss,Digits),0,"SELL STOP2",MagicNumber,0);//NormalizeDouble(Bid-(stopStepSizeInPips*Point) +(sellstopStepSizeInPips*Point)-(wait*Point),Digits)
           
 
   }
}
 

Reset the "count" to 0 ,     the code is messy, maybe it work maybe not :-)

  if( OrdersTotal() == 0 ) count = 0;
 
no it did not work . giving so manay order that zero all account i hour
 
Don't paste code
Play video
Please edit your post.
For large amounts of code, attach it.
 
WHRoeder:

Play video
Please edit your post.
For large amounts of code, attach it.

Your "gif" no longer works.
 
Must be sweep clean for others too.
 
angevoyageur: Your "gif" no longer works.
Fixed. They renamed UseSRC.gif to usesrc.gif  and other nonsense.