MQL4参考 物件函数 ObjectGetShiftByValue

ObjectGetShiftByValue

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

int  ObjectGetShiftByValue(
   string   object_name,   // object name
   double   value          // price
   );

Parameters

object_name

[in]  Object name.

value

[in]  Price value.

Returned value

The function calculates and returns bar index (shift related to the current bar) for the given price. The bar index 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.

Example:

  int shift=ObjectGetShiftByValue("MyTrendLine#123", 1.34);

See also

ObjectGetValueByShift()