Add a text above a horizontal line

 
In mql4 we can add some text to a HLine with ObjectSetText command. But in MQL5 I can't find any way to do this. Anybody Knows any solution to add a text above a Horizontal line?
 
mahmoodi1072: In mql4 we can add some text to a HLine with ObjectSetText command. But in MQL5 I can't find any way to do this. Anybody Knows any solution to add a text above a Horizontal line?

On both MQL5 and MQL4+ you can use ...

ObjectSetString

Sets the value of the corresponding object property

OBJPROP_TEXT

Description of the object (the text contained in the object)

string

 
Fernando Carreiro #:

On both MQL5 and MQL4+ you can use ...

ObjectSetString

Sets the value of the corresponding object property

OBJPROP_TEXT

Description of the object (the text contained in the object)

string

I used ObjectSetString , but my text doesn't display .

void OnStart()
  {
//---
   double price=SymbolInfoDouble(Symbol(),SYMBOL_BID)-(10*Point());
   if(!ObjectCreate(0,"price_line",OBJ_HLINE,0,0,price))
   {
      Print(__FUNCTION__,
            ": failed to create a Horizontal Line. Error code = ",GetLastError());
   }
   ObjectSetInteger(0,"price_line",OBJPROP_COLOR,clrBrown);
   ObjectSetInteger(0,"price_line",OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,"price_line",OBJPROP_WIDTH,1);
   ObjectSetInteger(0,"price_line",OBJPROP_SELECTABLE,true);
   ObjectSetInteger(0,"price_line",OBJPROP_SELECTED,false);
   ObjectSetInteger(0,"price_line",OBJPROP_HIDDEN,true);
   ObjectSetInteger(0,"price_line",OBJPROP_ZORDER,3);
   ObjectSetString(0,"price_line",OBJPROP_TEXT,"Price= " + DoubleToString(price));
   
  }
Files:
aaa.jpg  184 kb
bbb.jpg  194 kb
 
mahmoodi1072 #: I used ObjectSetString , but my text doesn't display .

F8 — Chart properties ... Show object descriptions


As produced by your code ...


 
Fernando Carreiro #:

F8 — Chart properties ... Show object descriptions


As produced by your code ...


thanks...