get price where horizontal line is drawn

 

Hi

This code failed to print out the price where the horizontal line is drawn, instead it is reporting 0. Any idea how to fix it?  Thanks


void OnTick()
  {
//---
int obj_total=ObjectsTotal();
for(int i=0;i<obj_total;i++)
   string name=ObjectName(i);     
   int objectType = ObjectType(name);
   double p = "";
   if (objectType == OBJ_HLINE){
      p = ObjectGet(name, OBJPROP_PRICE);
      Print("broke horizontal at: " + p);
...
 
p = ObjectGet(name, OBJPROP_PRICE);
Property OBJPRICE_PRICE is defined only for ObjectGetDouble(). Perhaps you should reread the manual.
          Object Properties - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference
Reason: