MQL4 - automated forex trading   /  

Forum

More Simple Creation of Labels

Back to topics list To post a new topic, please log in or register

avatar
6
shawnmstout 2009.11.03 14:30 

i got tired of always typing out all the values for creating a label, so i created a function for it, then you can just add in your own code into it



here is the code


//===========================Label Function================================
void fLabel(string lblname,int x,int y,string window,
string txt,int size,string font,color txtcolor){
ObjectCreate(lblname, OBJ_LABEL, WindowFind(window), 0, 0);
ObjectSet(lblname, OBJPROP_CORNER, 0);
ObjectSet(lblname, OBJPROP_XDISTANCE, x);
ObjectSet(lblname, OBJPROP_YDISTANCE, y);
ObjectSetText(lblname,txt,size,font, txtcolor);
return(0);
}


now to call it you simply write it like thise

fLabel("Balance",100,0,"Account_Info",BalanceStr,10,"Arial",MainColor);


and thats it

ill explain variables

they go like this


fLabel(label Name, x position, y position, window to put it in, text or value that you will be showing, font size, font type, fontcolor)


hope this helps someone


Object Approach in MQL

Object Approach in MQL

This article will be interesting first of all for programmers both beginners and professionals working in MQL environment. Also it would be useful if this article were read by MQL environment developers and ideologists, because questions that are analyzed here may become projects for future implementation of MetaTrader and MQL.


avatar
333
kimitrio 2010.01.29 20:44 
shawnmstout:

i got tired of always typing out all the values for creating a label, so i created a function for it, then you can just add in your own code into it



here is the code


//===========================Label Function================================
void fLabel(string lblname,int x,int y,string window,
string txt,int size,string font,color txtcolor){
ObjectCreate(lblname, OBJ_LABEL, WindowFind(window), 0, 0);
ObjectSet(lblname, OBJPROP_CORNER, 0);
ObjectSet(lblname, OBJPROP_XDISTANCE, x);
ObjectSet(lblname, OBJPROP_YDISTANCE, y);
ObjectSetText(lblname,txt,size,font, txtcolor);
return(0);
}


now to call it you simply write it like thise

fLabel("Balance",100,0,"Account_Info",BalanceStr,10,"Arial",MainColor);


and thats it

ill explain variables

they go like this


fLabel(label Name, x position, y position, window to put it in, text or value that you will be showing, font size, font type, fontcolor)


hope this helps someone


Thanks Bro...

Back to topics list  

To add comments, please log in or register