Download MetaTrader 5

Adding Text to a Horizontal Line

To add comments, please log in or register
DMFX
41
DMFX  
This seems like quite an easy thing that I am trying to do but I have created an indicator that draws a horizontal line and sends an alert when price passes the line. I just wanted to add text to the horizontal line so that the text is displayed just above the line at the far left. Is this possible and if so could someone let me know how to do it?

Many thanks.
qjol
3243
qjol  
ObjectCreate(string name, OBJ_TEXT (or OBJ_LABEL),....)
DMFX
41
DMFX  
qjol:


Thanks for the answer. I already have these lines in my code that creates the horizontal line, where do I put your suggestion?

ObjectCreate(LineName, OBJ_HLINE, 0, 0, Bid);

ObjectSet(LineName, OBJPROP_STYLE, LineStyle);
ObjectSet(LineName, OBJPROP_COLOR, LineColor);

DMFX
41
DMFX  
DMFX:


Thanks for the answer. I already have these lines in my code that creates the horizontal line, where do I put your suggestion?

ObjectCreate(LineName, OBJ_HLINE, 0, 0, Bid);

ObjectSet(LineName, OBJPROP_STYLE, LineStyle);
ObjectSet(LineName, OBJPROP_COLOR, LineColor);


Ok - so I have created a new label object which I can now see on my chart but how do I attach it to my horizontal line so that if the line is moved the label is moved as well?
gavin
390
gavin  
DMFX:

Ok - so I have created a new label object which I can now see on my chart but how do I attach it to my horizontal line so that if the line is moved the label is moved as well?

ObjectSetText(bs, "buy_stop", 8, "Arial", Magenta);
gavin
390
gavin  
gavin:

ObjectSetText(bs, "buy_stop", 8, "Arial", Magenta);

ObjectSetText(LineName, "What you want to call your line", 8, "Arial", Magenta);
DMFX
41
DMFX  
gavin:

ObjectSetText(LineName, "What you want to call your line", 8, "Arial", Magenta);

Thanks for the reply Gavin, but what I really want is text permanently on the chart just above the horizontal line so that when the line is moved the text is moved as well and you can always see it. Your suggestion is good but it only appears when you hover over the line.
gavin
390
gavin  
qjol:


No go to your platform properties and set "show object description to true..

DMFX
41
DMFX  
gavin:


No go to your platform properties and set "show object description to true..


Great Gavin - that works perfectly :)

Thanks for you help :)

BRYAN LEE
26
BRYAN LEE  
DMFX:


Great Gavin - that works perfectly :)

Thanks for you help :)


DMFX IS THERE ANY CHANCE YOU CAN SEND ME THIS INDICATOR? I WANT TO DRAW A HORIZONTAL LINE AND PUT TEXT ON IT AND THAT IT IS, BUT HAVE NO IDEA HOW TO MAKE MY OWN INDICATOR. I WOULD GREATLY APPRECIATE IT!
To add comments, please log in or register