What I'm trying to get in Pinescript Tradingview are horizontal lines generated from a date picker. Selecting a date(s) should make a new line or lines using that days high and low. The calculation is simple but there are two that I'd like to select from. So I'd get new high and low lines for the next day but the days I'd like to start from change that's the reason for the date picker.
Something like the below example but using the high and low of the day.
//@version=4
study("", "", true)
i_date = input(timestamp("2021-05-14"), type = input.time)
var float hi = na
var float lo = na
if time == i_date
hi := open * 1.02
lo := open * 0.99
plot(hi)
plot(lo)
You can use a
timestampas you did for the date, and then check if you are on the selected day by usingyear(),month()anddayofmonth()functions.Store the daily high and lows in a temp variable and when the selected day is over, simply use those temp variables.
In the below example, I have selected
03-Jan-24as my timestamp. As soon as the new day starts, it plots the high and low of the selected day.