box.new
Draws a rectangle from (left, top) to (right, bottom) and returns its handle. left/right are bar indexes or UTC ms times (xloc); the oldest boxes are deleted past max_boxes_count.
box.new(left: int/float, top: int/float, right: int/float, bottom: int/float, border_color: color = color.blue, border_width: int = 1, border_style: string = "solid", extend: string = "none", xloc: string = "bar_index", bgcolor: color = color.blue, text: string = "", text_size: string = "auto", text_color: color = na, text_halign: string = "center", text_valign: string = "center", text_wrap: string = na, text_font_family: string = na, text_formatting: int = na, force_overlay: bool = false) -> box
box.new(top_left: @chart.point, bottom_right: @chart.point, border_color: color = color.blue, border_width: int = 1, border_style: string = "solid", extend: string = "none", xloc: string = "bar_index", bgcolor: color = color.blue, text: string = "", text_size: string = "auto", text_color: color = na, text_halign: string = "center", text_valign: string = "center", text_wrap: string = na, text_font_family: string = na, text_formatting: int = na, force_overlay: bool = false) -> box
Parameters
leftint/float: x of the left edge. A bar index (bar_index), or a UTC ms time when the drawing uses xloc.bar_time.topint/float: Price of the top edge.rightint/float: x of the right edge. A bar index (bar_index), or a UTC ms time when the drawing uses xloc.bar_time.bottomint/float: Price of the bottom edge.border_colorcolor: Border color (default color.blue); na draws no border.border_widthint: Width in pixels, rounded to a whole number (na = 1, below 0 = 0).border_stylestring: line.style_solid, style_dashed or style_dottedextendstring: extend.*xlocstring: xloc.bar_index or xloc.bar_timebgcolorcolor: Fill color (default color.blue).textstring: Text inside the box (default none).text_sizestring: size.*text_colorcolor: na = the chart text colortext_halignstring: text.align_left, align_center or align_righttext_valignstring: text.align_top, align_center or align_bottomtext_wrapstring: Accepted for scripts from Pine and ignored: text is not wrapped.text_font_familystring: Accepted for scripts from Pine and ignored: text uses the chart font.text_formattingint: Accepted for scripts from Pine and ignored: text is drawn in the regular style (no bold or italic).force_overlaybool: Accepted for scripts from Pine and ignored: drawings stay in the script pane.top_left@chart.point: The top left corner. A chart.point: its index (xloc.bar_index) or its time (xloc.bar_time) is x, its price is y; na gives na coordinates.bottom_right@chart.point: The bottom right corner. A chart.point: its index (xloc.bar_index) or its time (xloc.bar_time) is x, its price is y; na gives na coordinates.
Example
box.new(bar_index - 10, high, bar_index, low, bgcolor=color.new(color.teal, 85), border_color=na)