- www.mql5.com
Return Value
The function returns true if the command has been successfully added to the queue of the specified chart, or false otherwise. If an object has already been created, an attempt is made to change its coordinates.
how long does it take to place one object on the chart?
//| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(1); //--- return(INIT_SUCCEEDED); } long timer=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTimer() { //--- timer++; Print(" Check Timer: "+IntegerToString(timer)); //--- SetText_subWindow("sub_tick",IntegerToString(timer),100,0,Blue,10); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SetText_subWindow(string name,string text,int x,int y,color colour,int size=12) { int find= ObjectFind(0,name); if(find>=0)// Object found in window 0 or window 1 { Print("OBJECT FOUND "+name+" chart window():"+find); if(ObjectSetString(0,name,OBJPROP_TEXT,text)) { Print("SetText_subWindow() Text Updated: "+text); } }else{ if(ObjectCreate(0,name,OBJ_LABEL,1,0,0)) { ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x); ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y); ObjectSetInteger(0,name,OBJPROP_COLOR,colour); ObjectSetInteger(0,name,OBJPROP_FONTSIZE,size); ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_UPPER); Print(" object created: "+name); }else{ Print(" object creation failed; Error(): "+GetLastError()); } } } //+------------------------------------------------------------------+
The timer() loop in on 54 while the object on the chart is still at 52.
How can the
the queue of the specified chart, become faster ? Is my code the source of the delay?
The timer() loop in on 54 while the object on the chart is still at 52.
How can the
the queue of the specified chart, become faster ? Is my code the source of the delay?
You need to refresh the chart : ChartRedraw().
Thank you.Next, how can I display Comment() on top of an object. The image below has two objects , one with ObjectSetInteger(0,name,OBJPROP_BACK,false); and other True. you will see that Comment() can only display if the object is ObjectSetInteger(0,name,OBJPROP_BACK,true);
The issue is, if set to TRUE, the candles overlay the object and the Comment() are unreadable.
Thank you.Next, how can I display Comment() on top of an object. The image below has two objects , one with ObjectSetInteger(0,name,OBJPROP_BACK,false); and other True. you will see that Comment() can only display if the object is ObjectSetInteger(0,name,OBJPROP_BACK,true);
The issue is, if set to TRUE, the candles overlay the object and the Comment() are unreadable.
I suggest you better create Text Labels to plot your text informations, and stop using Comment for that purpose.
Text labels allows you to choose Font, Color, Size and Position for any information, can be used both on EA and on Indicators.
I just use Comment() for quick debuging purpose while coding.
because Commen() can be rewriten by any other indicator, like a "shared place" to put info. It is not reliable to keep important informations.
https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_label
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I would like to open a subwindow via expert advisor but I do not see any Chart function that can open a subwindow without attaching an indicator(shell code with #property indicator_separate_window)
I can not attach the #property indicator_separate_window to an expert advisor without the compiler requiring the OnCalc() function which shouldn't be need for the wubwindow to operate.