MQL4参考 物件函数 ObjectGetInteger


The function returns the value of the corresponding object property. The object property must be of the datetime, int, color, bool or char type. There are 2 variants of the function.

1. Immediately returns the property value.

long  ObjectGetInteger(
   long     chart_id,         // chart identifier
   string   object_name,      // object name
   int      prop_id,          // property identifier
   int      prop_modifier=0   // property modifier, if required

2. Returns true or false, depending on the success of the function. If successful, the property value is placed to a receiving variable passed by reference by the last parameter.

bool  ObjectGetInteger(
   long     chart_id,         // chart identifier
   string   object_name,      // object name
   int      prop_id,          // property identifier
   int      prop_modifier,    // property modifier
   long&    long_var          // here we accept the property value



[in]  Chart identifier. 0 means the current chart.


[in]  Name of the object.


[in]  ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_INTEGER enumeration.


[in]  Modifier of the specified property. For the first variant, the default modifier value is equal to 0. Most properties do not require a modifier.  It denotes the number of the level in Fibonacci tools and in the graphical object Andrew's pitchfork. The numeration of levels starts from zero.


[out]  Variable of the long type that receives the value of the requested property.

Return Value

The long value for the first calling variant.

For the second variant the function returns true, if this property is maintained and the value has been placed into the long_var variable, otherwise returns false. To read more about the error call GetLastError().