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
Dear coders!
My problem: I want to display a label within a separate window. My code below does not work. Where is the mistake?
Thanks for any help!!
walb
//---------------------------------------------------------
drawLabel("trend",text,22,color_text,10,10,"CourierBold");
//---------------------------------------------------
void drawLabel(string id, string text,int fsize, color fcolor,int x,int y,string font="CourierBold",int window = 0)
{
if(ObjectFind(id)==-1)
{
ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0);
ObjectCreate(id, OBJ_LABEL, window, 0, 0);
ObjectSetText(id,text, fsize, font, fcolor);
ObjectSet(id, OBJPROP_CORNER, 1);
ObjectSet(id, OBJPROP_XDISTANCE, x);
ObjectSet(id, OBJPROP_YDISTANCE, y);
}
else
{
ObjectDelete(id);
ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0);
ObjectCreate(id, OBJ_LABEL, window, 0, 0);
ObjectSetText(id,text, fsize, font, fcolor);
ObjectSet(id, OBJPROP_CORNER, 1);
ObjectSet(id, OBJPROP_XDISTANCE, x);
ObjectSet(id, OBJPROP_YDISTANCE, y);
}
}
//-------------------------------