Download MetaTrader 5
To add comments, please log in or register
Download MetaTrader 5 for iPad and trade anywhere!
Max
58
Max 2015.11.20 19:27 

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
7984
Keith Watford 2015.11.20 20:28  

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 2015.11.20 20:58  
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