4200 Error on object

 

I am getting 4200 error, i tried to fix but failed.using RSI to change object.


void textobject_side()
  {
   textobject_array[0] = "-------------------------------------------";
   textobject_array[1] = "";
   textobject_array[4] = "";
   textobject_array[5] = "";
   textobject_array[6] = "";
   textobject_array[7] = "";
   textobject_array[2] = "example@gmail.com";
   textobject_array[8] = "Skype : example";
   textobject_array[9] = "Telegram : example";
   textobject_array[3] = "-------------------------------------------";
   textobject_array[10] = ":: ==>HAPPY TRADING<== ::";
   textobject_array[11] = "-------------------------------------------";
   
   double irsi_0 = iRSI(NULL, PERIOD_M1, 3, PRICE_CLOSE, 0);
   if(irsi_0 < 15.0)
      textobject_array[1] = "::::+ALGO+::::";
   else
     {
      if(irsi_0 >= 15.0 && irsi_0 < 30.0)
         textobject_array[4] = "::::+ALGO+::::";
      else
        {
         if(irsi_0 >= 30.0 && irsi_0 <= 60.0)
            textobject_array[5] = "::::+ALGO+::::";
         else
           {
            if(irsi_0 >= 60.0 && irsi_0 <= 80.0)
               textobject_array[6] = "::::+ALGO+::::";
            else
               textobject_array[7] = "::::+ALGO+::::";
           }
        }
     }
   ObjectCreate("ObjLabel1", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel1", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel1", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel1", OBJPROP_YDISTANCE, 17);
   ObjectSetText("ObjLabel1", textobject_array[0], 10, "Arial", Yellow);
   ObjectCreate("ObjLabel2", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel2", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel2", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel2", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel2", textobject_array[1], 17, "Arial", Aqua);
   ObjectCreate("ObjLabel5", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel5", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel5", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel5", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel5", textobject_array[4], 17, "Arial", Red);
   ObjectCreate("ObjLabel6", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel6", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel6", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel6", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel6", textobject_array[5], 17, "Arial", Blue);
   ObjectCreate("ObjLabel7", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel7", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel7", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel7", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel7", textobject_array[6], 17, "Arial", Yellow);
   ObjectCreate("ObjLabel8", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel8", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel8", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel8", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel8", textobject_array[7], 17, "Arial", DarkOrange);
   ObjectCreate("ObjLabel4", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel4", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 55);
   ObjectSetText("ObjLabel4", textobject_array[2], 10, "Arial", Lime);
   ObjectCreate("ObjLabel3", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel3", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel3", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel3", OBJPROP_YDISTANCE, 110);
   ObjectSetText("ObjLabel3", textobject_array[0], 10, "Arial", Yellow);
   
   
   ObjectCreate("ObjLabe21", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabe21", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabe21", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabe21", OBJPROP_YDISTANCE, 75);
   ObjectSetText("ObjLabe21", textobject_array[8], 10, "Arial", Lime);
   ObjectCreate("ObjLabe22", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabe22", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabe22", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabe22", OBJPROP_YDISTANCE, 95);
   ObjectSetText("ObjLabe22", textobject_array[9], 10, "Arial", Lime);
   ObjectCreate("ObjHappy", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjHappy", OBJPROP_CORNER, 1);
   ObjectSet("ObjHappy", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjHappy", OBJPROP_YDISTANCE, 140);
   ObjectSetText("ObjHappy", textobject_array[10], 10, "Arial", Lime);
   ObjectCreate("ObjLabel24", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel24", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel24", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel24", OBJPROP_YDISTANCE, 155);
   ObjectSetText("ObjLabel24", textobject_array[0], 10, "Arial", Yellow);
   
   int Li_16 = Time[0] + 60 * Period() - TimeCurrent();
   double Ld_8 = Li_16 / 60.0;
   int Li_20 = Li_16 % 60;
   Li_16 = (Li_16 - Li_16 % 60) / 60;
   ObjectDelete("time");
   if(ObjectFind("time") != 0)
     {
      ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
      ObjectSetText("time", "                             " + Li_16 + ":" + Li_20, 14, "Arial", Orange);
      return;
     }
   ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
  }
 

Error 4200 means the object with the name specified already exists.

One solution is removing Objects before creating them.

   ObjectDelete("ObjLabel24");
   ObjectCreate("ObjLabel24", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel24", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel24", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel24", OBJPROP_YDISTANCE, 155);
   ObjectSetText("ObjLabel24", textobject_array[0], 10, "Arial", Yellow);
 
Yashar Seyyedin #:
One solution is removing Objects before creating them.

Like this?


void textobject_side()
  {
   textobject_array[0] = "-------------------------------------------";
   textobject_array[1] = "";
   textobject_array[4] = "";
   textobject_array[5] = "";
   textobject_array[6] = "";
   textobject_array[7] = "";
   textobject_array[2] = "example@gmail.com";
   textobject_array[8] = "Skype : example";
   textobject_array[9] = "Telegram : example";
   textobject_array[3] = "-------------------------------------------";
   textobject_array[10] = ":: ==>HAPPY TRADING<== ::";
   textobject_array[11] = "-------------------------------------------";
   
   double irsi_0 = iRSI(NULL, PERIOD_M1, 3, PRICE_CLOSE, 0);
   if(irsi_0 < 15.0)
      textobject_array[1] = "::::+ALGO+::::";
   else
     {
      if(irsi_0 >= 15.0 && irsi_0 < 30.0)
         textobject_array[4] = "::::+ALGO+::::";
      else
        {
         if(irsi_0 >= 30.0 && irsi_0 <= 60.0)
            textobject_array[5] = "::::+ALGO+::::";
         else
           {
            if(irsi_0 >= 60.0 && irsi_0 <= 80.0)
               textobject_array[6] = "::::+ALGO+::::";
            else
               textobject_array[7] = "::::+ALGO+::::";
           }
        }
     }
  
   ObjectsDeleteAll(0,"Obj",-1,-1);
   ObjectCreate("ObjLabel1", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel1", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel1", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel1", OBJPROP_YDISTANCE, 17);
   ObjectSetText("ObjLabel1", textobject_array[0], 10, "Arial", Yellow);

   
   ObjectCreate("ObjLabel2", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel2", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel2", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel2", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel2", textobject_array[1], 17, "Arial", Aqua);

   
   ObjectCreate("ObjLabel5", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel5", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel5", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel5", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel5", textobject_array[4], 17, "Arial", Red);


   ObjectCreate("ObjLabel6", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel6", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel6", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel6", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel6", textobject_array[5], 17, "Arial", Blue);


   ObjectCreate("ObjLabel7", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel7", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel7", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel7", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel7", textobject_array[6], 17, "Arial", Yellow);


   ObjectCreate("ObjLabel8", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel8", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel8", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel8", OBJPROP_YDISTANCE, 30);
   ObjectSetText("ObjLabel8", textobject_array[7], 17, "Arial", DarkOrange);


   ObjectCreate("ObjLabel4", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel4", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel4", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel4", OBJPROP_YDISTANCE, 55);
   ObjectSetText("ObjLabel4", textobject_array[2], 10, "Arial", Lime);

   ObjectCreate("ObjLabel3", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel3", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel3", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel3", OBJPROP_YDISTANCE, 110);
   ObjectSetText("ObjLabel3", textobject_array[0], 10, "Arial", Yellow);
   
   
   ObjectCreate("ObjLabe21", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabe21", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabe21", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabe21", OBJPROP_YDISTANCE, 75);
   ObjectSetText("ObjLabe21", textobject_array[8], 10, "Arial", Lime);


   ObjectCreate("ObjLabe22", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabe22", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabe22", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabe22", OBJPROP_YDISTANCE, 95);
   ObjectSetText("ObjLabe22", textobject_array[9], 10, "Arial", Lime);


   ObjectCreate("ObjHappy", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjHappy", OBJPROP_CORNER, 1);
   ObjectSet("ObjHappy", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjHappy", OBJPROP_YDISTANCE, 140);
   ObjectSetText("ObjHappy", textobject_array[10], 10, "Arial", Lime);


   ObjectCreate("ObjLabel24", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ObjLabel24", OBJPROP_CORNER, 1);
   ObjectSet("ObjLabel24", OBJPROP_XDISTANCE, 10);
   ObjectSet("ObjLabel24", OBJPROP_YDISTANCE, 155);
   ObjectSetText("ObjLabel24", textobject_array[0], 10, "Arial", Yellow);
   
   int Li_16 = Time[0] + 60 * Period() - TimeCurrent();
   double Ld_8 = Li_16 / 60.0;
   int Li_20 = Li_16 % 60;
   Li_16 = (Li_16 - Li_16 % 60) / 60;
   ObjectDelete("time");
   if(ObjectFind("time") != 0)
     {
      ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
      ObjectSetText("time", "                             " + Li_16 + ":" + Li_20, 14, "Arial", Orange);
      return;
     }
   ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
  }

I have added ObjectsDeleteAll(0,"Obj",-1,-1);