How to Create Object Label

 

Dear Experts!

I have created object line to show me the highest price line. But I wanted to put some test label on the line which would move together with the line up or down but not getting idea how to do it. below is my object line code.

Any guidance will be highly appreciated!


void OnTick()
{
  MqlRates PriceInfo[];

  int Data = CopyRates(Symbol(), PERIOD_H4, 0,7,PriceInfo);
  ArraySetAsSeries(PriceInfo, true);
  double HighestPrice=NormalizeDouble(PriceInfo[1].high,_Digits);
  

     ObjectCreate(_Symbol,"HighestPrice",OBJ_HLINE,0,0,HighestPrice);
     ObjectSetInteger(0,"HighestPrice", OBJPROP_COLOR,clrGold);
     ObjectSetInteger(0,"HighestPrice",OBJPROP_WIDTH, 3);
     ObjectMove(_Symbol,"HighestPrice",0,0,HighestPrice);
}
 
it will give 4200 error object already exsists so try creating it outside of OnTick() for example in OnInit() and then only update in OnTick() with ObjectMove()
 
Marco vd Heijden:
it will give 4200 error object already exsists so try creating it outside of OnTick() for example in OnInit() and then only update in OnTick() with ObjectMove()

It is normally working with me. but I will do as advised!

But how can I put text label on the line?