如何获取特定日期的柱线索引 [英] How to get bar index on specific date

查看:54
本文介绍了如何获取特定日期的柱线索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是松树脚本的新手.我想比较 2 个特定日期的价格.

I am new to pine script. I want to compare the prices on 2 specific date.

但是我如何获得特定日期的 bar_index?

But how would I get the bar_index on a particular date?

提前致谢

推荐答案

timestamp 函数将返回指定日期和时间的 UNIX 时间.

timestamp function would return UNIX time of specified date and time.

如果以毫秒为单位的时间多于 1 月 3 日,请抓住低点.对于日内在时间戳函数中指定分钟.

If time in ms is more the Jan 3, grab the low. For intraday specify minutes in the timestamp function.

//@version=4
study("low on specific date")

specificDate = time >= timestamp(2019, 1, 3, 00, 00)

var float lowOnDate= na
if specificDate and not specificDate[1]
    lowOnDate := low
plot(lowOnDate)

这篇关于如何获取特定日期的柱线索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆