How to get bar index on specific date

浪子不回头ぞ 提交于 2021-02-17 02:46:30

问题


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

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

Thanks in advance


回答1:


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

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)


来源:https://stackoverflow.com/questions/63025721/how-to-get-bar-index-on-specific-date

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!