Hi, sheriffonline.
The right "Status_Color" global variable type is "color".
color Status_Color = clrRed;
Hi, sheriffonline.
The right "Status_Color" global variable type is "color".
Thanks evetonbg. i declared "Status_Color" as you mentioned. but still shows 2 warnings?
warnings:
'CommentLab' - expression on global scope not allowed Function "CommentLab" is not referenced and will be removed from exp-file
Code I used:
#include <stdlib.mqh> #include <WinUser32.mqh> // exported variables color Status_Color = Red; int init() { } // Expert start int start() { } void CommentLab(string CommentText) { string CommentLabel; int CommentIndex = 0; if (CommentText == "") { // delete all Comment texts while(ObjectFind(StringConcatenate("CommentLabel", CommentIndex )) >= 0) { ObjectDelete(StringConcatenate("CommentLabel", CommentIndex )); CommentIndex++; } return; } while(ObjectFind(StringConcatenate("CommentLabel", CommentIndex )) >= 0) { CommentIndex++; } CommentLabel = StringConcatenate("CommentLabel", CommentIndex); ObjectCreate(CommentLabel, OBJ_LABEL, 0, 0, 0 ); ObjectSet(CommentLabel, OBJPROP_CORNER, 0); ObjectSet(CommentLabel, OBJPROP_XDISTANCE, 5); ObjectSet(CommentLabel, OBJPROP_YDISTANCE, 115 + (CommentIndex * 15) ); ObjectSetText(CommentLabel, CommentText, 10, "Tahoma", Status_Color ); } CommentLab("This is testing"); int deinit() { if (false) ObjectsDeleteAll(); }
No text displayed on chart while i run EA
You really need to start googling some of your questions, as they have been asked many times.
Start by searching Google for "expression on global scope not allowed".
The warning: "Function "CommentLab" is not referenced and will be removed from exp-file" is fairly self-explanatory, but again a Google search of "is not referenced and will be removed from exp-file" will lead you to your solutions.
honest_knave: You really need to start googling some of your questions, as they have been asked many times. | Or this |
Thanks for everyone. I fixed and works well. even i did better option after dicussed here.
Here is the Code for CommentLab Function
void CommentLab(int CommentIndex,int Corner,int XDistance,int YDistance,color Color_Status,int Font_Size,string Font_Name,string CommentText) { string CommentLabel; if (CommentText == "") { // delete all Comment texts return; } CommentLabel = StringConcatenate("CommentLabel", CommentIndex); ObjectCreate(CommentLabel, OBJ_LABEL, 0, 0, 0 ); ObjectSet(CommentLabel, OBJPROP_CORNER, Corner); ObjectSet(CommentLabel, OBJPROP_XDISTANCE, XDistance); ObjectSet(CommentLabel, OBJPROP_YDISTANCE, YDistance); ObjectSetText(CommentLabel, CommentText, Font_Size, Font_Name, Color_Status ); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I really wanted to use this function written by "RaptorUK", but i am still getting error.
I am not expert with ObjectLabel, but i tried my best to display objects on screen, too much of line i wrote.
so i would like to use CommentLab
her eis the code:
I declared Status_Color as Global variable string
Please advice me to use the above function correctly. so that i can call this function as much as i want to use. currently i write line by line too much, so its lacking memory and speed.
Thanks in Advance.