On a 1 minute chart (or any timeframe), I'm using the request.security function to get the open price, open time and closing time from the daily timeframe. What I'm looking to do is draw a horizontal line where y=day's open price, x1 = day's open time and x2 = day's closing time. I've tried several iterations that all work and print a separate horizontal line for each of the previous days, however for some reason the current day (session that has not closed yet) does not print a line. I'm assuming it has something to do with my use of "time_close" and the fact that the session hasn't actually closed yet.
Here is my code...
//@version=5
indicator("myTest", overlay=true)
//get open price, open time and close time from daily
[d_open, d_time_open, d_time_close] = request.security(syminfo.tickerid,"D", [open,time,time_close])
//check for first bar of the day
is_first_bar = ta.change(time("D"))
if (is_first_bar)
//print line from beginning of day to end of day at the opening price of the day if first bar of day
line.new(d_time_open, d_open, d_time_close, d_open, xloc.bar_time, extend.none, color.yellow, line.style_solid, 1)
Screen shot showing a yellow line everyday except for the current/last session...