Can't get values of the objects

 
int objects = ObjectsTotal();
     string comment = StringConcatenate("\n\n", objects);
     for(int i=ObjectsTotal()-1; i>=0; i--)
      {
         string name = ObjectName(i);
         ENUM_OBJECT type = (ENUM_OBJECT) ObjectGetInteger(0,name,OBJPROP_TYPE);
         if(type = OBJ_HLINE)
            {
               double price = ObjectGetValueByShift(name,0);
               comment = StringConcatenate(comment," \n",name," ->",price);
               Print(comment);
            }  
         
      }

This is the code that I run to get price values of the objects in my EA. Even though I get the names of the objects, I can't get their values. Check the screenshots. Where is the mistake?


Files:
ss.jpg  841 kb
 
ObjectType - Object Functions - MQL4 Reference
ObjectType - Object Functions - MQL4 Reference
  • docs.mql4.com
ObjectType - Object Functions - MQL4 Reference
 

One object has type, name, description and window.

I think you can get all of them:

  • ObjectName()
  • ObjectType()
  • ObjectDescription()
So if your value is in the object description, you can get it with ObjectDescrption()
 

I misunderstood your question, you can try with the second variant of the function - https://www.mql5.com/en/docs/objects/objectgetinteger.

Or change

ENUM_OBJECT type

to

ENUM_OBJECT_PROPERTY_INTEGER type
Documentation on MQL5: Object Functions / ObjectGetInteger
Documentation on MQL5: Object Functions / ObjectGetInteger
  • www.mql5.com
[in]  Modifier of the specified property. For the first variant, the default modifier value is equal to 0. Most properties do not require a modifier.  It denotes the number of the level in Fibonacci tools and in the graphical object Andrew's pitchfork. The numeration of levels starts from zero. For the second variant the function returns true...