Display text on terminal MQL5.

To add comments, please log in or register
Blooper1980
213
Blooper1980  

I use to be able to do this in MQL4, but now I can not do this in MQL5.

I found many 1/2 answers or how to's, but none works.

If anybody would be so kind as to perhaps so me the full code.

Just place text on x,y with color, nothing complicated...

Thank you kindly for any assistance. 

Alain Verleyen
36058
Alain Verleyen  
Blooper1980:

I use to be able to do this in MQL4, but now I can not do this in MQL5.

I found many 1/2 answers or how to's, but none works.

If anybody would be so kind as to perhaps so me the full code.

Just place text on x,y with color, nothing complicated...

Thank you kindly for any assistance. 

Please show your code if you need coding help.
Shin Joo Young
799
Shin Joo Young  

https://www.mql5.com/en/docs/objects/objectsetstring


I will make sample code.

wait for some time.
Documentation on MQL5: Object Functions / ObjectSetString
Documentation on MQL5: Object Functions / ObjectSetString
  • www.mql5.com
The function sets the value of the corresponding object property. The object property must be of the string type. There are 2 variants of the function. [in]  Modifier of the specified property.  It denotes the number of the level in Fibonacci tools and in the graphical object Andrew's pitchfork. The numeration of levels starts from zero. The...
Shin Joo Young
799
Shin Joo Young  
ObjectCreate(0,"Test",OBJ_LABEL,0,0,0,0,0,0,0);
   
ObjectSetString(0,"Test",OBJPROP_TEXT,"Say Hello");
   
ObjectSetInteger(0,"Test",OBJPROP_XDISTANCE,50);
ObjectSetInteger(0,"Test",OBJPROP_YDISTANCE,50);
ObjectSetInteger(0,"Test",OBJPROP_CORNER,CORNER_RIGHT_UPPER);
   
ObjectSetInteger(0,"Test",OBJPROP_COLOR,clrAliceBlue);


Change "Test", "Say Hello", 50, CORNER, color to your code.

I checked this code working in mql5.
amando
791
amando  

its 100% the same code as in MT4


bool LabelCreate(const long              chart_ID=0,// ID des Charts 
                 const string            name="Label",             // Name des Labels 
                 const int               sub_window=0,             // Nummer des Unterfensters 
                 const int               x=0,                      // X-Koordinate 
                 const int               y=0,                      // Y-Koordinate 
                 const ENUM_BASE_CORNER  corner=CORNER_LEFT_LOWER, // Winkel des Charts zu Binden 
                 const string            text="Label",             // Text 
                 const string            font="Arial",             // Schrift 
                 const int               font_size=10,             // Schriftgröße 
                 const color             clr=clrRed,               // Farbe 
                 const double            angle=0.0,                // Text Winkel 
                 const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER, // Bindungsmethode 
                 const bool              back=false,               // Im Hintergrund 
                 const bool              selection=false,          // Wählen um zu bewegen 
                 const bool              hidden=true,              // Ausgeblendet in der Objektliste 
                 const long              z_order=0)                // Priorität auf Mausklick 
  {
//--- Setzen den Wert des Fehlers zurück 
   ResetLastError();
//--- ein Text-Label erstellen 
   if(!ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0))
     {
      Print(__FUNCTION__,
            ": Text-Label konnte nicht erstellt werden! Fehlercode = ",GetLastError());
      return(false);
   ;}
//--- Die Koordinaten des Schilds setzen 
   ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- wählen die Ecke des Charts, relativ zu der die Punktkoordinaten eingegeben werden 
   ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- den Text setzen 
   ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- Textschrift setzen 
   ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- Schriftgröße setzen 
   ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- Text-Winkel angeben 
   ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
//--- die Bindungsmethode setzen 
   ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- Farbe setzen 
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- Im Vordergrund (false) oder Hintergrund (true) anzeigen 
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- Aktivieren (true) oder deaktivieren (false) Mausbewegung Modus 
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- Verbergen (true) oder Anzeigen (false) den Namen des graphischen Objektes in der Objektliste 
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- setzen die Priorität für eine Mausklick-Ereignisse auf dem Chart 
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- die erfolgreiche Umsetzung 
   return(true);
;}
Omar Alkassar
4075
Omar Alkassar  
Use chartredraw() after create objects
Blooper1980
213
Blooper1980  
Shin Joo Young:


Change "Test", "Say Hello", 50, CORNER, color to your code.

I checked this code working in mql5.

I know someone whom I will be calling "THE MAN" from now on! Thank you so much, you rock!

To add comments, please log in or register