How to Create Object Label

To add comments, please log in or register
Deep Raj
31
Deep Raj  

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);
}
Marco vd Heijden
Moderator
8160
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()
Deep Raj
31
Deep Raj  
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?

To add comments, please log in or register