title: How can you use the values of open/high/low/close of the first candle of the day as a variable in pine script?
body: <p>I am trying to write a script in pine that would trigger a series of actions when the price breaches the high/low prices of the first 15 minute candle. How do I go about it?</p>
  
  <p>I have come across the below code online:</p>
  
  <pre><code>study(title="OR", shorttitle="OpeningRange", overlay=true)
  up15on = input(true, title="15 Minute Opening Range High")
  down15on = input(true, title="15 Minute Opening Range Low")
  
  is_newbar(res) =&gt; change(time(res)) != 0 
  
  adopt(r, s) =&gt; security(syminfo.tickerid, r, s) 
  
  high_range = valuewhen(is_newbar('D'),high,0)
  low_range = valuewhen(is_newbar('D'),low,0)
  
  high_rangeL = valuewhen(is_newbar('D'),high,0) 
  low_rangeL = valuewhen(is_newbar('D'),low,0) 
  
  up15 = plot(up15on ? adopt('15', high_rangeL): na, color = #53cbe9, style=plot.style_line, linewidth=1) 
  down15 = plot(down15on ? adopt('15', low_rangeL): na, color = #e97d53, style=plot.style_line, linewidth=1) 
  
  trans15 = up15on ?  97 : 100
  fill(up15, down15, color = color.white, transp=trans15)
  </code></pre>
  
  <p>The above code plots the high/low as a line on the chart but I don't want the values to be plotted on the chart. I want those values as a variable. I am trying to figure out what this part does: <code>up15on ? adopt('15', high_rangeL): na, color = #53cbe9, style=plot.style_line, linewidth=1</code></p>
  
  <p>I don't understand why there is a condition to check the up15on with adopt('15', high_rangeL). I would appreciate it if someone could explain it. </p>
  
  <p>Modified code:</p>
  
  <pre><code>study(title="OR", shorttitle="OpeningRange", overlay=true)
  up15on = input(true, title="15 Minute Opening Range High")
  down15on = input(true, title="15 Minute Opening Range Low")
  
  is_newbar(res) =&gt; change(time(res)) != 0 
  
  adopt(r, s) =&gt; security(syminfo.tickerid, r, s) 
  
  high_range = valuewhen(is_newbar('D'),high,0)
  low_range = valuewhen(is_newbar('D'),low,0)
  
  
  candle_color = close&gt;adopt('15', high_range) ? color.purple :
   close&lt;adopt('15', low_range) ? color.yellow :
   na
  
  barcolor( candle_color )
  </code></pre>