Getting Anchor Point Value

 

Does anyone know how to get the Value of the x y anchor point?

I have tried using the following


double AnchorPrice = ObjectGetDouble(0,"test",OBJPROP_PRICE,0);


Thanks

Files:
 

This depends on the object type. 

See here:

https://www.mql5.com/de/docs/constants/objectconstants/enum_object_property

Some have an achor point which can be queried just as you tried, others have coordinates.

Dokumentation zu MQL5: Konstanten, Enumerationen und Strukturen / Objektkonstanten / Objekteigenschaften
Dokumentation zu MQL5: Konstanten, Enumerationen und Strukturen / Objektkonstanten / Objekteigenschaften
  • www.mql5.com
Objekteigenschaften - Objektkonstanten - Konstanten, Enumerationen und Strukturen - Nachschlagewerk MQL5 - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für MetaTrader 5
 

the object is one that uses x y cordinates. 

I have figured out the solution though for getting the price of x y coordinates the following is how I did it:

   double x = ObjectGet("test",OBJPROP_XDISTANCE);
   double y = ObjectGet("test",OBJPROP_YDISTANCE);
   //below are the 3 variables set to recieve the output from the function
   int window;
   datetime time;
   double price;
   ChartXYToTimePrice(0,(int)x,(int)y,window,time,price);
Alert(price);
 

it is an 

OBJ_LABEL



not sure if there is a better way to get the price rather then the way I have figured out. 


Please share if you have another way 


Cheers


Dominik Christian Egert #:

This depends on the object type. 

See here:

https://www.mql5.com/de/docs/constants/objectconstants/enum_object_property

Some have an achor point which can be queried just as you tried, others have coordinates.

Dokumentation zu MQL5: Konstanten, Enumerationen und Strukturen / Objektkonstanten / Objekttypen / OBJ_LABEL
Dokumentation zu MQL5: Konstanten, Enumerationen und Strukturen / Objektkonstanten / Objekttypen / OBJ_LABEL
  • www.mql5.com
OBJ_LABEL - Objekttypen - Objektkonstanten - Konstanten, Enumerationen und Strukturen - Nachschlagewerk MQL5 - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für MetaTrader 5
 
Nope. That's how it is done.
 
What else do you need? The price y is a double number, but x is the time of a bar, it is basically an integer or datetime value but you need to look into ObjectGetInteger(). Was that helpful?




Reason: