How can I read the text of the label that MQL4 draw when I override an H-line object with the mouse?

 

I guys, I need some help. When I override an HLine object with the mouse, Mql4 draw a label that contain a text of index and level price of Hline. How can I read this text by an Custom Indicator, or an EA or a script?

Tank you for every help.

 

HLines have only one coordinate.

Perhaps you should read the manual. Read the object's price. ObjectGetDoubleENUM_OBJECT_PROPERTY_DOUBLE → OBJPROP_PRICE

 

Hi William, if I don't know the name of object or object index how can I solve the ObjectGetDouble?

Tanks a lot.

 

It also has a string value.

string text = ObjectGetString(0,"obj_name",OBJPROP_TEXT);
 
80613536: I don't know the name of object or object index how can I solve the ObjectGetDouble?

Start reading the documentation. ObjectsTotal and ObjectName

 
Hi William, hi Marco, I don't understand your advices. If I don't know the Objetc Name nor the object index, I can with ObjectsTotal know the Max object index but by that I can only do a for cycle on all object index, but they are a lot and I search a alternative way.
 
80613536 I can only do a for cycle on all object index, but they are a lot and I search a alternative way.

There is no alternative. Go through the list, find the object you want, do what you want with it. Only you know the type, the naming pattern, etc.

 
80613536:
Hi William, hi Marco, I don't understand your advices. If I don't know the Objetc Name nor the object index, I can with ObjectsTotal know the Max object index but by that I can only do a for cycle on all object index, but they are a lot and I search a alternative way.

What are you trying to do ? 

Is this ObjectName always the same ? 

How do you know you have the desired Object ? 

The hover pop up is the tooltip.

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ScanObjects()
{
   int obj_total=ObjectsTotal(0);
   string name;
   string text;
   string tip;
   for(int i=0; i<obj_total; i++)
      {
         name = ObjectName(0,i);
         text = ObjectGetString(0,name,OBJPROP_TEXT);
         tip  = ObjectGetString(0,name,OBJPROP_TOOLTIP);
         Print(i," object: ",name," text: ",text," tip: ",tip);
      }
}
//+------------------------------------------------------------------+