Download MetaTrader 5

ObjectGetValueByShift does not work with horizontal lines?

To add comments, please log in or register
Max
58
Max  

I am trying to get the value (price for last bar) of a horizontal line (added manually to a graph) by the function ObjectGetValueByShift( after renaming it from object properties as "MyLine)"  ,  but the value returned is always zero.

The same function works correctly with a trendline added manually to the graph and renamed with same name "MyLine").

The code I am using for the EA  is  :

double price=ObjectGetValueByShift("MyLine", 0);

Any explanation for this weird behaviour ?

Keith Watford
Moderator
10614
Keith Watford  

Why would you need to get the value by shift?

It is a horizontal line, there is only 1 price value 

  double price=ObjectGetDouble(0,"MyLine",OBJPROP_PRICE);

 .

Max
58
Max  
GumRai:

Why would you need to get the value by shift?

It is a horizontal line, there is only 1 price value 

 .

I see, great !   With your code the call now works smoothly.

Thank you a lot GumRai


Regards

Max

To add comments, please log in or register