How create object in Tester (visual mode) MT4 Build 600+

 

In old version MT4 (Build 600-) was possible create objects in Tester - visual mode.

But for new build 600+ my code not function, wrote "Error: can't create object name:tester code #4202"

If I use the same code as script and add to chart (no chart tester), object create ok.

   long current_chart_id=ChartID();
   string name="tester";
//--- creating label object (it does not have time/price coordinates)
   if(!ObjectCreate(current_chart_id,name,OBJ_TEXT,0,0,0))
     {
      Print("Error: can't create object name:", name," code #",GetLastError());
     }

   ObjectSetDouble(current_chart_id,name,OBJPROP_PRICE,Low[0]-100*Point);
   ObjectSetInteger(current_chart_id,name,OBJPROP_TIME,Time[0]);
   ObjectSetInteger(current_chart_id,name,OBJPROP_COLOR,clrWhite);
   //--- set text property
   ObjectSetString(current_chart_id,name,OBJPROP_FONT, "Wingdings" );
   ObjectSetString(current_chart_id,name,OBJPROP_TEXT, CharToStr(140) );

 When is error?

 

Are you sure the error code is 4202?

4202

ERR_OBJECT_DOES_NOT_EXIST

Object does not exist

 

 That doesn't make sense, you would would expect that error when modifying object properties.

 
GumRai:

Are you sure the error code is 4202?

4202

ERR_OBJECT_DOES_NOT_EXIST

Object does not exist

 

 That doesn't make sense, you would would expect that error when modifying object properties.

:-) I know code 4202 GetLastError(), I don´t know why the same code in script is valid, create object. In tester mode return error.... ???
 

I tried your code and got the same result as you.

It seems that the problem stems from ChartID()

This code

void OnTick()
  {

   //long current_chart_id=ChartID();
   string name="tester";
   if(ObjectFind(0,name)<0)
     {
      if(!ObjectCreate(0,name,OBJ_TEXT,0,0,0))
        {
         Print("Error: can't create object name:",name," code #",GetLastError());
        }
     }
   ObjectSetDouble(0,name,OBJPROP_PRICE,Low[0]-100*Point);
   ObjectSetInteger(0,name,OBJPROP_TIME,Time[0]);
   ObjectSetInteger(0,name,OBJPROP_COLOR,clrWhite);
//--- set text property
   ObjectSetString(0,name,OBJPROP_FONT,"Wingdings");
   ObjectSetString(0,name,OBJPROP_TEXT,CharToStr(140));
//---

  }

 using 0 for the current chart works perfectly

 
GumRai:

I tried your code and got the same result as you.

It seems that the problem stems from ChartID()

This code

 using 0 for the current chart works perfectly

Yes with the STretagy Tester, it must always be 0.
 
angevoyageur:
Yes with the STretagy Tester, it must always be 0.

You have true!  

Support graphical objects in only Visual Mode! 

if (IsVisualMode() ) current_chart_id=0;

if (IsVisualMode() ) current_chart_id=0;
.... <others code>
Reason: