Remove text from chart

 

So I created a text object and display it,

e.g ObjectCreate(0,labelID,OBJ_LABEL,0,100,100);

...but if its output changes the old text doesn't disappear.  

How to refresh the chart to remove the old text?

Thanks.

 

Update it with

ObjectSetString(....

function.

https://www.mql5.com/en/docs/objects/objectsetstring

You can set (or get) several variables.

ENUM_OBJECT_PROPERTY_STRING

Identifier

Description

Property Type

OBJPROP_NAME

Object name

string

OBJPROP_TEXT

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

string

OBJPROP_TOOLTIP

The text of a tooltip. If the property is not set, then the tooltip generated automatically by the terminal is shown. A tooltip can be disabled by setting the "\n" (line feed) value to it

string

OBJPROP_LEVELTEXT

Level description

string    modifier=level number

OBJPROP_FONT

Font

string

OBJPROP_BMPFILE

The name of BMP-file for Bitmap Label. See also Resources

string    modifier: 0-state ON, 1-state OFF

OBJPROP_SYMBOL

Symbol for the Chart object

string

 

For you i believe it's

OBJPROP_TEXT
Documentation on MQL5: Object Functions / ObjectSetString
Documentation on MQL5: Object Functions / ObjectSetString
  • www.mql5.com
Object Functions / ObjectSetString - Reference on algorithmic/automated trading language for MetaTrader 5
 
Marco vd Heijden:

Update it with

ObjectSetString(....

function.

https://www.mql5.com/en/docs/objects/objectsetstring

You can set (or get) several variables.

ENUM_OBJECT_PROPERTY_STRING

Identifier

Description

Property Type

OBJPROP_NAME

Object name

string

OBJPROP_TEXT

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

string

OBJPROP_TOOLTIP

The text of a tooltip. If the property is not set, then the tooltip generated automatically by the terminal is shown. A tooltip can be disabled by setting the "\n" (line feed) value to it

string

OBJPROP_LEVELTEXT

Level description

string    modifier=level number

OBJPROP_FONT

Font

string

OBJPROP_BMPFILE

The name of BMP-file for Bitmap Label. See also Resources

string    modifier: 0-state ON, 1-state OFF

OBJPROP_SYMBOL

Symbol for the Chart object

string

 

For you i believe it's

OBJPROP_TEXT
Yes, thanks Marco.  Also be sure to remove the prior object using ObjectDelete before rewriting the new one :)
Reason: