跳到正文
QMT

ContextInfo.get_date_location

取给定日期对应的K线索引号,如给定日期小于当前图K线对应的最早的日期,结果返回0;如给定日期大于当前图K线对应的最新日期,结果返回最新K线的索引号

原型

ContextInfo.get_date_location(strdate)

参数

参数 类型 说明
strdate string yyyymmdd 格式日期,例如 20170711。

返回值

number

示例

以下代码依据官方示例整理缩进,并将旧式 print 写法改为函数调用;账号使用占位值。

def handlebar(ContextInfo):
    print(ContextInfo.get_date_location('20170711'))

官方来源

迅投 QMT 官方函数检索表,条目 ContextInfo.get_date_location。本页属于 QMT 内置 Python 接口;原站函数检索表同时收录其他语言,不能按网页路径将本条目误归为 VBA。网页核对日期:2026-10-11。

本页目录