Try :-
bool ObjectSetText( string name, string text, int font_size, string font=NULL, color text_color=CLR_NONE)
Here's a snippet that also adds a price label (as the bid/ask lines)
//+------------------------------------------------------------------+ //| Helper | //+------------------------------------------------------------------+ void SetLevel(string text, double level, color col1) { string labelname= text + " Label"; string linename= text + " Line"; if (ObjectFind(labelname) != 0) { ObjectCreate(labelname, OBJ_TEXT, 0, Time[20], level); ObjectSetText(labelname, " " + text, 8, "Arial", White); } else { ObjectMove(labelname, 0, Time[20], level); } if (ObjectFind(linename) != 0) { ObjectCreate(linename, OBJ_HLINE, 0, Time[40], level); ObjectSet(linename, OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(linename, OBJPROP_COLOR, col1); } else { ObjectMove(linename, 0, Time[40], level); } }
great!
thank you
thank you
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
does anybody know how to set the description property to line objects that are created programmatically?
I wrote the following code, but couldn't find how to set the 'description property' (the description that is shown upside the line when drawn in charts)
ObjectCreate("line1", OBJ_HLINE, 0, Time[0], value);
ObjectSet("line1", OBJPROP_WIDTH, 1);
ObjectSet("line1", OBJPROP_COLOR, White);
is there an OBJPROP_DESCRIPTION property or sth like that?
thank you,
Pepo.