问题
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