Download MetaTrader 5

change anchor position

To add comments, please log in or register
deserttim
11
deserttim  

Hi, I am really interested in how you change the 'anchor point' text labels.

I have some code, would upload but don't yet have the authors permission to upload yet. 

I want to edit the code to place all the text labels on the top right of my charts

Thanks

honest_knave
Moderator
2326
honest_knave  

Be careful not to confuse anchor points with chart corners:

   ObjectSetInteger(0, "MyLabelName", OBJPROP_CORNER, CORNER_RIGHT_UPPER);

You then need to set all your X and Y distances relative to that corner.


whroeder1
15913
whroeder1  
deserttim: I am really interested in how you change the 'anchor point' text labels.

First you need to decide wether you have a text object or a label object.

  1. Text objects are attached to a bar and have ObjectSetInteger OBJPROP_ANCHOR ENUM_ANCHOR_POINT
  2. Label objects are attached to the chart, with pixel distances relative to a corner.
deserttim
11
deserttim  
whroeder1:

First you need to decide wether you have a text object or a label object.

  1. Text objects are attached to a bar and have ObjectSetInteger OBJPROP_ANCHOR ENUM_ANCHOR_POINT
  2. Label objects are attached to the chart, with pixel distances relative to a corner.


Here we go

"ObjectCreate("lbl_Buy_Pips2", OBJ_LABEL, 0, 0, 0);"

"ObjectSet("lbl_Buy_Pips2", OBJPROP_XDISTANCE, 50);"

"ObjectSet("lbl_Buy_Pips2", OBJPROP_YDISTANCE, 145);"

"ObjectSetText("lbl_Buy_Pips2","",10,font_type,Yellow);"

I would like the tex objects equally spaced but located in the top right hand corner of the screen

whroeder1
15913
whroeder1  
That is not a text object, that is a label. honest_knave already answered that question.
To add comments, please log in or register