Jump to content

Setting text background color (MQL4)


dlewisfl

Recommended Posts

There's no way to set the background color of a text object (OBJ_LABEL or OBJ_TEXT) that I can find. A workaround would be to draw an OBJ_RECTANGLE with background property set true. This is all well and good when these objects are in a fixed location on the chart. I want to be able to specify screen loaction in the EA parameters to move the box/text objects - the problem is that text objects use pixel offsets for placement and rectangle object uses a time/price to determine screen location. Does anyone have an algorithm to convert time/price to pixels (or vice-versa)? Can it even be done using only MQL4 syntax? I don't see any built-in functions/properties to get it done.

 

Thanks!

Link to comment
Share on other sites

In case anyone is interested, I found a way to do this by using two OBJ_LABEL objects. The first contains the text I want displayed, the second uses the Webdings font 'g' character which is shaded rectangle that takes the entire character space. You can either set the Webdings object to a large font size for one large box or set a string of 'g's which gives you more flexibility in box shape.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...