SeriesInfoInteger
SeriesInfoInteger
返回有关历史数据状态的信息。函数调用有两种方式。
直接返回属性值。
long SeriesInfoInteger(
string symbol_name, // symbol name
ENUM_TIMEFRAMES timeframe, // period
ENUM_SERIES_INFO_INTEGER prop_id // property identifier
);根据函数运行的成功与否返回 true 或 false。
bool SeriesInfoInteger(
string symbol_name, // symbol name
ENUM_TIMEFRAMES timeframe, // period
ENUM_SERIES_INFO_INTEGER prop_id, // property ID
long& long_var // variable for getting info
);参数
- symbol_name
[in] 符号名称。
- timeframe
[in] 时间段。
- prop_id
[in] 请求的属性的标识符,来自 ENUM_SERIES_INFO_INTEGER 枚举的值。
- long_var
[out] 存储所请求属性值的变量。
返回值
第一种情况下,返回长类型的值。
第二种情况下,如果指定属性可用且其值已存储在 long_var 变量中,则返回 true;否则返回 false。有关错误的更多详细信息,请调用 GetLastError()。
示例:
void OnStart()
{
//---
Print("Total number of bars for the symbol-period at this moment = ",
SeriesInfoInteger(Symbol(),0,SERIES_BARS_COUNT));
Print("The first date for the symbol-period at this moment = ",
(datetime)SeriesInfoInteger(Symbol(),0,SERIES_FIRSTDATE));
Print("The first date in the history for the symbol-period on the server = ",
(datetime)SeriesInfoInteger(Symbol(),0,SERIES_SERVER_FIRSTDATE));
}最后更新于