MQL4 Reference Object Functions ObjectGetValueByShift

ObjectGetValueByShift

The function calculates and returns the price value for the specified bar (shift related to the current bar).

double  ObjectGetValueByShift(
   string   object_name,   // object name
   int      shift          // bar index
   );

Parameters

object_name

[in]  Object name.

shift

[in]  Bar index.

Returned value

The function calculates and returns the price value for the specified bar (shift related to the current bar). The price value is calculated by the first and second coordinates using a linear equation. Applied to trendlines and similar objects. To get the detailed error information, one has to call the GetLastError() function.

Note

When this function is used on the current chart, this chart is accessed directly, while in order to receive the properties of an object on a different chart, a synchronous call is used. The synchronous call means that the function waits for the execution of all commands that have been enqueued for this chart prior to its call, therefor this function can be time consuming. This feature should be taken into account when working with a large number of objects on a chart.

Example:

  double price=ObjectGetValueByShift("MyTrendLine#123", 11);

See also

ObjectGetShiftByValue()