Display text on terminal MQL5.

 

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. 

 
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.
 

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...
 
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.
 

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);
;}
 
Use chartredraw() after create objects
 
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!

 

Hello,

I wonder if somebody could perhaps help me out.

Trying to display text in MQL5 on my charts, but to no avail.


Found this snippet:

   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);


But it displays nothing at all.

Is there a way to output simple text with a label in front?


What I am trying to achieve is for example,

to show the spread value somewhere on my chart like:

   Spread: <value>

 
Shin Joo Young:


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

I checked this code working in mql5.

What is this supposed to do?

It displays nothing whatsoever.


Is there something missing?

 

i want to write out the minimum lot size to be copied as text to clipboard but instead it returns 34. Can someone help?


              This is what i have 

                  

               text+="\r\n"+"Minimum Lot => "+SYMBOL_VOLUME_MIN;
               text+="\r\n"+"Remember to ALWAYS Manage Your Money Well";
               CopyTextToClipboard(text);
              }
 
  1. Oluseyi Elemosho #: i want 

    Don't double post! You already had another thread open.

              General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

  2. Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.