title: How I can draw automatic boxes on specific Candles in Pine Script?
body: <p>I'm trying to program an indicator that show the resistant area</p>
  <p>the resistant area should be box ( triangle )</p>
  <p>the main idea that the indicator detect the highest red candles with upper tale more that 50% of the candle length</p>
  <pre><code>// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  // © TEST
  
  //@version=4
  study(&quot;--- TEST --- &quot;, overlay=true)
  
  redbar = close &lt; open
  greenbar = close &gt; open
  low_tale = min(close,open) - low
  upper_tale = high - max(open,close)
  candle_length = high - low
  
  
  hiLen = input(title=&quot;High Length&quot;, type=input.integer, defval=25)
  hiHighs = highest(high, hiLen)[1]
  
  loLen = input(title=&quot;Low Length&quot;, type=input.integer, defval=25)
  loLows = lowest(low, loLen)[1]
  
  
  if redbar and upper_tale &gt; ( 0.5 * candle_length ) and high &gt; hiHighs
      label.new(bar_index, high, &quot;Short&quot;, yloc = yloc.abovebar, color = color.red, style = label.style_arrowdown)
  </code></pre>
  <p>the demo image as shown now</p>
  <p><a href="https://i.stack.imgur.com/kVd2S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kVd2S.png" alt="it shows red arrows, but I wanna it show a box " /></a></p>
  <p>this is what I wanna to do</p>
  <p><a href="https://i.stack.imgur.com/mrQ2K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mrQ2K.png" alt="enter image description here" /></a></p>
  <ul>
  <li>I wanna to show the last 4 candles with it's box as shown with the same condition , but i can increase it or decrease it as input</li>
  </ul>
  <p>** of course the top of the box is the high of the target candle and the Low of the box is the low of the target candle</p>