Is there a limit to the number of graphic objects I can create for MQL4 ?

 

Hi,

I remember reading about this subject in the documentation but can't seem to find this subject anywhere now. 

The reason I ask is because I get error 4200 for ObjectCreate of almost the same exact object. 
Wondering of there is a limit etc. 

//----------------------B19
   string name19="B19";
   if(!ObjectCreate(0,name19,OBJ_TEXT,0,0,0))
     {
      Print(__FUNCTION__,
            ": failed to create the button! Error code = ",GetLastError());
      return(false);
     }
 
   ObjectSetText(name19,"B",18,"Arial",clrYellow); //change buy text color
//--- successful execution


//----------------------B20
   string name20="B20";
   if(!ObjectCreate(0,name20,OBJ_TEXT,0,0,0))
     {
      Print(__FUNCTION__,
            ": failed to create the button! Error code = ",GetLastError());
      return(false);
     }
 
   ObjectSetText(name20,"C",18,"Arial",clrYellow); //change buy text color
//--- successful execution


B19 does not produce error 4200 while B20 does ? 
I have a number of OBJ_TEXT objects so I wondered if I have hit a limit or something. 

Confused. 

Please advise

Thanks


 
Agent86:

Hi,

I remember reading about this subject in the documentation but can't seem to find this subject anywhere now. 

The reason I ask is because I get error 4200 for ObjectCreate of almost the same exact object. 
Wondering of there is a limit etc. 


B19 does not produce error 4200 while B20 does ? 
I have a number of OBJ_TEXT objects so I wondered if I have hit a limit or something. 

Confused. 

Please advise

Thanks


Why don’t you say how many you have before the error 
Why don’t you simply do a test?

 
Agent86:

Hi,

I remember reading about this subject in the documentation but can't seem to find this subject anywhere now. 

The reason I ask is because I get error 4200 for ObjectCreate of almost the same exact object. 
Wondering of there is a limit etc. 


B19 does not produce error 4200 while B20 does ? 
I have a number of OBJ_TEXT objects so I wondered if I have hit a limit or something. 

Confused. 

Please advise

Thanks


Even if there is 4 objects won't stretch it , you can put waaaay more strain on the chart.

If this is the same code as before maybe B20 is not deleted in the specific point in time with the specific market conditions.

But why do you exit if object is not created ? If you get 4200 it means it exists so you can just edit it (move on to the set command)

something like this more or less

//----------------------B20
   string name20="B20";
ResetLastError();   
if(!ObjectCreate(0,name20,OBJ_TEXT,0,0,0))
     {
     if(GetLastError()!=4200){
      Print(__FUNCTION__,
            ": failed to create the button! Error code = ",GetLastError());
      return(false);
     }
     }
 
   ObjectSetText(name20,"C",18,"Arial",clrYellow); //change buy text color
 
Paul Anscombe #:
Why don’t you say how many you have before the error 
Why don’t you simply do a test?

Well, good question and my inexperience is the reason mostly. 


Print("Objects Total = ",ObjectsTotal()); 
= 20

So this is just OBJ_TEXT there are Rectangles and Labels too. 

Is there such a limit ?

Thanks

 
Lorentzos Roussos #:

Even if there is 4 objects won't stretch it , you can put waaaay more strain on the chart.

If this is the same code as before maybe B20 is not deleted in the specific point in time with the specific market conditions.

But why do you exit if object is not created ? If you get 4200 it means it exists so you can just edit it (move on to the set command)

something like this more or less

Yes it's the same code with some minor changes. 

I searched the EA via meta editor and found only 1 instance of this code and any reference to it elsewhere is commented out. 

//----------------------B20
   string name20="B20";
   if(!ObjectCreate(0,name20,OBJ_TEXT,0,0,0))
     {
      Print(__FUNCTION__,
            ": failed to create the button! Error code = ",GetLastError());
      return(false);
     }
 
   ObjectSetText(name20,"C",18,"Arial",clrYellow); //change buy text color
//--- successful execution

Strangely I can change the code to name201, or name29 or almost anything except name20 and this error does not exist with the same function with different arguments/parameters such as:

name29="B29";  etc. 

There is nothing else in the code that references B20 or name20 except those that are commented out completely. 

I'll keep looking but it's a copy and past of previous Create and just changed the parameters from B19 to B20 etc. 


 
Agent86 #:

Yes it's the same code with some minor changes. 

I searched the EA via meta editor and found only 1 instance of this code and any reference to it elsewhere is commented out. 

Strangely I can change the code to name201, or name29 or almost anything except name20 and this error does not exist with the same function with different arguments/parameters such as:

name29="B29";  etc. 

There is nothing else in the code that references B20 or name20 except those that are commented out completely. 

I'll keep looking but it's a copy and past of previous Create and just changed the parameters from B19 to B20 etc. 


I recall you are deleting all your objects on deinit  ?