title: Pine: How to set background color based on a condition
body: <p>I'm trying to have the entire background colored on a condition (e.g. green) if the last close is above the close 50 bars back and red if it's below.<br>
  I've tried different approaches and I can change the color, but it doesn't end up coloring the entire background, but only certain areas.</p>
  
  <p>My script:</p>
  
  <pre><code>bgcolor(close[50] &gt;= open[1] ? color.red : color.green, transp=70)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/F5FUc.png" rel="nofollow noreferrer">split colors in background</a></p>
  
  <p>In this case the entire background should be red, since the last close is below the close 50 bars back (indicated by the yellow label).<br>
  Any ideas on what I need to change?</p>