Text Label Position

 

Hi,

Please help me with the Text Label Position ( I want to move it to the left side As it is showing in the attached photo) I'm try my best but i couldn't find the solution .





int start()
  {
//---
            
               double priceH=iHigh(Symbol(),PERIOD_D1,1);
               ObjectCreate("highLine",OBJ_HLINE,0,0,priceH);
               ObjectSet("highLine",OBJPROP_COLOR,clrRed);
               ObjectSet("highLine",OBJPROP_WIDTH,1);
               ObjectSet("highLine",OBJPROP_STYLE,2);

               
               double priceL=iLow(Symbol(),PERIOD_D1,1);
               ObjectCreate("lowLine",OBJ_HLINE,0,0,priceL);
               ObjectSet("lowLine",OBJPROP_COLOR,clrRed);
               ObjectSet("lowLine",OBJPROP_WIDTH,1);
               ObjectSet("lowLine",OBJPROP_STYLE,2);
                        
            
            
               ObjectCreate("Dlabel", OBJ_TEXT, 0, Time[0], priceH);
               ObjectSetText("Dlabel", " D1 H Alert", 8, "Arial", White);
         
               ObjectCreate("Dlabel2", OBJ_TEXT, 0, Time[0], priceL);
               ObjectSetText("Dlabel2", " D1 L Alert", 8, "Arial", White);
               
   return(0);


 
ObjectSet("highLine",OBJPROP_CORNER,CORNER_LEFT_UPPER);
 

Hi eevviill;

Thank you for your reply But I need to move the (TEXT) and not in the (LEFT_UPPER) it should be  Jointly with (HLINE)

               ObjectCreate("Dlabel", OBJ_TEXT, 0, Time[0], priceH);
               ObjectSetText("Dlabel", " D1 H Alert", 8, "Arial", White);


The code you post not working with it?

 

Than change Time[0]

to Time[FirstVisibleBar()-6] 

 

Wow, Thank you very much ,

I appreciate your help, still one thing I just note,

How to make the (HLINE) Update automatically when a new candle start, because now i need to change time frame to change position.


Thank again

 
FxTrader_:

Wow, Thank you very much ,

I appreciate your help, still one thing I just note,

How to make the (HLINE) Update automatically when a new candle start, because now i need to change time frame to change position.


Thank again

https://www.mql5.com/en/blogs/post/662291

 

This may not be exactly what you want as the display has limitations the same as comments

Put in init

   ChartSetInteger(0,CHART_SHOW_OBJECT_DESCR,true);
   
   double priceH=iHigh(Symbol(),PERIOD_D1,1);
   ObjectCreate("highLine",OBJ_HLINE,0,0,priceH);
   ObjectSet("highLine",OBJPROP_COLOR,clrRed);
   ObjectSet("highLine",OBJPROP_WIDTH,1);
   ObjectSet("highLine",OBJPROP_STYLE,2);
   ObjectSetString(0,"highLine",OBJPROP_TEXT," D1 H Alert");

   double priceL=iLow(Symbol(),PERIOD_D1,1);
   ObjectCreate("lowLine",OBJ_HLINE,0,0,priceL);
   ObjectSet("lowLine",OBJPROP_COLOR,clrRed);
   ObjectSet("lowLine",OBJPROP_WIDTH,1);
   ObjectSet("lowLine",OBJPROP_STYLE,2);
   ObjectSetString(0,"lowLine",OBJPROP_TEXT," D1 L Alert");

Then in your main code

   
   double priceH=iHigh(Symbol(),PERIOD_D1,1);
   ObjectSetDouble(0,"highLine",OBJPROP_PRICE,priceH);

   double priceL=iLow(Symbol(),PERIOD_D1,1);
   ObjectSetDouble(0,"lowLine",OBJPROP_PRICE,priceL);

No need for the text labels, but I don't believe that it is possible to change the colour or the font size.

It is just a relatively simple way to label the lines on the far left of the chart.

 

Thank u very much GumRai


I appreciate your help it is work fine

 
FxTrader_:

Thank u very much GumRai


I appreciate your help it is work fine

That is the beauty of forums where people help each other.

I have to admit that I only learnt about this method of labelling lines fairly recently. That was thanks to the generosity of a poster on another forum sharing his knowledge.

 
GumRai:

That is the beauty of forums where people help each other.

I have to admit that I only learnt about this method of labelling lines fairly recently. That was thanks to the generosity of a poster on another forum sharing his knowledge.

Oh. Than you can use like this

int start()
  {
//new bar?
string name="highLine";
double priceH=iHigh(Symbol(),PERIOD_D1,1);
   
            if(ObjectFined(name)==-1)
{
               ObjectCreate(name,OBJ_HLINE,0,0,priceH);
               ObjectSet(name,OBJPROP_COLOR,clrRed);
               ObjectSet(name,OBJPROP_WIDTH,1);
               ObjectSet(name,OBJPROP_STYLE,2);
}
//newbar
ObjectSetDouble(0,name,OBJPROP_PRICE,priceH);
 
I appreciate all of you Thank you very very much
Reason: