MQL4 Reference Object Functions ObjectGetValueByTime

MQL4 Help as One File:

ObjectGetValueByTime

The function returns the price value for the specified time value of the specified object.

double  ObjectGetValueByTime(
   long       chart_id,      // chart ID
   string     object_name,   // object name
   datetime   time,          // time
   int        line_id=0      // line ID
   );

Parameters

chart_id

[in]  Chart identifier.

object_name

[in]  Name of the object.

time

[in]  Time value.

line_id=0

[in]  Line identifier.

Return Value

The price value for the specified time value of the specified object.

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, that is why this function can be time consuming. This feature should be taken into account when working with a large number of objects on a chart.

An object can have several values in one price coordinate, therefore it is necessary to specify the line number. This function applies only to the following objects:

  • Trendline (OBJ_TREND)
  • Trendline by angle (OBJ_TRENDBYANGLE)
  • Gann line (OBJ_GANNLINE)
  • Equidistant channel (OBJ_CHANNEL) - 2 lines
  • Linear regression channel (OBJ_REGRESSION) - 3 lines
  • Standard deviation channel (OBJ_STDDEVCHANNEL) - 3 lines

See also

Object Types