need help adding a label to indicator

 

Can someone add a label to this indicator at the end of the line where I can add text through the properties window of the indicator? link to codebase

please pretty please...

It should look similar to this price label but I want to add custom text.



 






  

    
   




  

 

   




  
   
    
    
     

   

 

Anyone have any idea as to how this would be done?

Can it be done?


I am guessing ObjectCreate but I have no idea what represents the line or how to attach a label to the line.

I want an external string at the end of the price of the indicator....

 
Any tips or suggestions would be appreciated.
 

Still waiting for help?

 
thanks for reference. this will be my homework for weekend.
 

Ok any other ideas? I was unable to add a label to the indicator that displays text. This is very hard to do.

 
// See https://docs.mql4.com/constants/objectconstants/enum_object/obj_label

//+------------------------------------------------------------------+
//| Create a text label - Place this in your global scope body       |
//+------------------------------------------------------------------+
bool LabelCreate(const long              chart_ID=0,               // chart's ID
                 const string            name="Label",             // label name
                 const int               sub_window=1,             // subwindow index
                 const int               x=150,                      // X coordinate
                 const int               y=150,                      // Y coordinate
                 const ENUM_BASE_CORNER  corner=CORNER_LEFT_UPPER, // chart corner for anchoring
                 const string            text="Label",             // text
                 const string            font="Arial",             // font
                 const int               font_size=10,             // font size
                 const color             clr=clrRed,               // color
                 const double            angle=0.0,                // text slope
                 const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER, // anchor type
                 const bool              back=false,               // in the background
                 const bool              selection=false,          // highlight to move
                 const bool              hidden=true,              // hidden in the object list
                 const long              z_order=0)                // priority for mouse click
  {
//--- reset the error value
   ResetLastError();
//--- create a text label
   if(!ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0))
     {
      Print(__FUNCTION__,
            ": failed to create text label! Error code = ",GetLastError());
      return(false);
     }
//--- set label coordinates
   ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
   ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set the chart's corner, relative to which point coordinates are defined
   ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- set the text
   ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text font
   ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font size
   ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set the slope angle of the text
   ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
//--- set anchor type
   ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set color
   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- display in the foreground (false) or background (true)
   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the label by mouse
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
   return(true);
  }


//+------------------------------------------------------------------+
//| Then call LableCreate function:                                  |
//| Put this in your void OnStart() if it is a constant lable,       |
//| or this in your OnCalculate() if the text value is variable.     |
//+------------------------------------------------------------------+

   string MyLableString = "This is my lable";
   LabelCreate(0,"Tool Tip Text",1,50,50,CORNER_LEFT_UPPER,MyLableString,"Arial",10,
      Yellow,0.0,ANCHOR_CENTER,false,true,true,0);
Reason: