title: How to plot a horizontal line based off a specific closing candle and timeframe
body: <p>I am looking to plot a horizontal line in tradingview (pine script) based on a specific time and on a specific time frame.  So for example I want to plot a hline on the close of the 5m candle at the 1600 (4pm EST) timeframe.</p>
  
  <p>Ive tried a lot but cant seem to figure out how to a historic value within pine script.  Meaning you are looking to plot a line from 4pm and have it show on your charts for the rest of that day and the beginning of the next day.  It simple to do this with the function show_last = 1 within PS. but I cant figure out how to calculate the 5m closing candle at 4pm?</p>
  
  <p>Some of my code that doesnt work fully</p>
  
  <pre><code>//@version=3
  study("4pm_Line")
  
  highTimeFrame = input("5", type = resolution)
  sessSpec = input("1600-0930", type = session)
  
  is_newbar(res, sess) =&gt;
      t = time(res, sess)
      na(t[1]) and not na(t) or t[1] &lt; t
  
  newbar = is_newbar("5", sessSpec)
  s2 = na
  s2 := newbar ? close : nz(s2[1])
  
  plot(s2, style=line, linewidth=1, color=lime, trackprice = true, 
       show_last = 1)
  </code></pre>
  
  <p>The line that plots is off and i have no idea how its getting its values.</p>