Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
DMFX
32
DMFX 2010.12.14 13:08 
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 2010.12.14 13:16  
ObjectCreate(string name, OBJ_TEXT (or OBJ_LABEL),....)
DMFX
32
DMFX 2010.12.14 13:23  
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
32
DMFX 2010.12.14 13:31  
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
369
gavin 2010.12.14 13:34  
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
369
gavin 2010.12.14 13:36  
gavin:

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

ObjectSetText(LineName, "What you want to call your line", 8, "Arial", Magenta);
DMFX
32
DMFX 2010.12.14 13:41  
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
369
gavin 2010.12.14 13:51  
qjol:


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

DMFX
32
DMFX 2010.12.14 14:00  
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
5
BRYAN LEE 2014.04.25 03:34  
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