Download MetaTrader 5

Text Label Position

To add comments, please log in or register
fxtrader_
247
fxtrader_  

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


Vasyl Nosal
19436
Vasyl Nosal  
ObjectSet("highLine",OBJPROP_CORNER,CORNER_LEFT_UPPER);
fxtrader_
247
fxtrader_  

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?

Vasyl Nosal
19436
Vasyl Nosal  

Than change Time[0]

to Time[FirstVisibleBar()-6] 

fxtrader_
247
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

Vasyl Nosal
19436
Vasyl Nosal  
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

Keith Watford
Moderator
10566
Keith Watford  

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.

fxtrader_
247
fxtrader_  

Thank u very much GumRai


I appreciate your help it is work fine

Keith Watford
Moderator
10566
Keith Watford  
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.

Vasyl Nosal
19436
Vasyl Nosal  
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);
fxtrader_
247
fxtrader_  
I appreciate all of you Thank you very very much
12
To add comments, please log in or register