Functions
box.new()
Creates a box from left/top/right/bottom coordinates, or from two chart.point corners.
Syntax · 1 of 2
box.new(series int left, series float top, series int right, series float bottom, series color border_color, series int border_width, series string border_style, series string extend, series string xloc, series color bgcolor, series string text, series string text_size, series color text_color, series string text_halign, series string text_valign, series string text_wrap, series string text_font_family, const bool force_overlay, series string text_formatting) → series box
Arguments
left required series int Left x-coordinate (bar index or time, depending on xloc). top required series float Top price of the box. right required series int Right x-coordinate (bar index or time, depending on xloc). bottom required series float Bottom price of the box. border_color required series color Border color. Optional. border_width series int Border width in pixels. Optional. border_style series string Border style (line.style_*). Optional. extend series string Whether the box extends past its corners: extend.none, left, right, or both. xloc series string xloc.bar_index or xloc.bar_time. Default is bar_index. bgcolor required series color Background fill color of the box. Optional. text series string Text drawn inside the box. Optional. text_size series string Text size. Optional. text_color required series color Text color. Optional. text_halign series string Horizontal text align: left, center, or right. text_valign series string Vertical text align: top, center, or bottom. text_wrap series string If true, wrap text inside the box. Optional. text_font_family series string Font family. Optional. force_overlay const bool If true, draw on the main pane even when the script is not overlay. Default is false. text_formatting series string Text formatting (none, bold, italic). Optional. Return Type
series box Syntax · 2 of 2
box.new(series chartPoint top_left, series chartPoint bottom_right, series color border_color, series int border_width, series string border_style, series string extend, series string xloc, series color bgcolor, series string text, series string text_size, series color text_color, series string text_halign, series string text_valign, series string text_wrap, series string text_font_family, const bool force_overlay, series string text_formatting) → series box
Arguments
top_left required series chartPoint Top-left corner as a chart.point (alternative to left/top). bottom_right required series chartPoint Bottom-right corner as a chart.point (alternative to right/bottom). border_color required series color Border color. Optional. border_width series int Border width in pixels. Optional. border_style series string Border style (line.style_*). Optional. extend series string Whether the box extends past its corners: extend.none, left, right, or both. xloc series string xloc.bar_index or xloc.bar_time. Default is bar_index. bgcolor required series color Background fill color of the box. Optional. text series string Text drawn inside the box. Optional. text_size series string Text size. Optional. text_color required series color Text color. Optional. text_halign series string Horizontal text align: left, center, or right. text_valign series string Vertical text align: top, center, or bottom. text_wrap series string If true, wrap text inside the box. Optional. text_font_family series string Font family. Optional. force_overlay const bool If true, draw on the main pane even when the script is not overlay. Default is false. text_formatting series string Text formatting (none, bold, italic). Optional. Return Type
series box Example
//@lipi=2
indicator("box.new Example", overlay=true)
if barstate.islast {
box.new(bar_index[10], high, bar_index, low, bgcolor=color.new(color.blue, 0.8), border_color=color.blue)
}