Box
Handle for a box drawing.
Static Methods
new
Creates a new box object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
left | series int | The left coordinate (bar index or UNIX time). | |
top | series float | The top coordinate (price). | |
right | series int | The right coordinate (bar index or UNIX time). | |
bottom | series float | The bottom coordinate (price). | |
border_color | series color | color.BLUE | The border color of the box. |
border_width | series int | 1 | The border width in pixels. |
border_style | series LineStyle | LineStyle.Solid | The border line style. |
extend | series Extend | Extend.None | The extension mode: Extend.None, Extend.Left, Extend.Right, or Extend.Both. |
xloc | series Xloc | Xloc.BarIndex | The x-location type: Xloc.BarIndex or Xloc.BarTime. |
bgcolor | series color | color.BLUE | The background color of the box. |
text | series string | "" | The text content of the box. |
text_size | series int | 0 | The text size in pixels. |
text_color | series color | color.BLACK | The text color. |
text_halign | series TextHAlign | TextHAlign.Right | The horizontal text alignment. |
text_valign | series TextVAlign | TextVAlign.Center | The vertical text alignment. |
text_wrap | series TextWrap | TextWrap.None | The text wrapping mode. |
text_font_family | series FontFamily | FontFamily.Default | The font family for the text. |
force_overlay | const bool | false | If true, the box is rendered on top. |
text_formatting | const TextFormat | text.NONE | The text formatting options. |
Returns: series Box
Static Properties
all
Returns an array filled with all the current boxes drawn by the script.
Methods
copy
Box.copy(id: series Box): series BoxCreates a copy of the specified box and returns its id.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to copy. |
Returns: series Box
delete
Box.delete(id: series Box)Deletes the specified box from the chart.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to delete. |
get_bottom
Box.get_bottom(id: series Box): series floatReturns the price value of the bottom border of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to get the bottom coordinate from. |
Returns: series float
get_left
Box.get_left(id: series Box): series intReturns the bar index or the UNIX time (depending on the last value used for 'xloc') of the left border of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to get the left coordinate from. |
Returns: series int
get_right
Box.get_right(id: series Box): series intReturns the bar index or the UNIX time (depending on the last value used for 'xloc') of the right border of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to get the right coordinate from. |
Returns: series int
get_top
Box.get_top(id: series Box): series floatReturns the price value of the top border of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to get the top coordinate from. |
Returns: series float
set_bg_color
Box.set_bg_color(id: series Box, color: series color)Sets the background color of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
color | series color | The new background color. |
set_border_color
Box.set_border_color(id: series Box, color: series color)Sets the border color of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
color | series color | The new border color. |
set_border_style
Box.set_border_style(id: series Box, style: series LineStyle)Sets the border style of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
style | series LineStyle | The new border line style. |
set_border_width
Box.set_border_width(id: series Box, width: series int)Sets the border width of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
width | series int | The new border width in pixels. |
set_bottom
Box.set_bottom(id: series Box, bottom: series float)Sets the bottom coordinate of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
bottom | series float | The new bottom coordinate (price). |
set_bottom_right_point
Box.set_bottom_right_point(id: series Box, point: series chart.Point)Sets the bottom-right corner of the box using a chart.Point object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
point | series chart.Point | The chart.Point object specifying the new bottom-right corner. |
set_extend
Box.set_extend(id: series Box, extend: series Extend)Sets extending type of the border of this box object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
extend | series Extend | The extension mode: Extend.None, Extend.Left, Extend.Right, or Extend.Both. |
set_left
Box.set_left(id: series Box, left: series int)Sets the left coordinate of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
left | series int | The new left coordinate (bar index or UNIX time). |
set_lefttop
Box.set_lefttop(id: series Box, left: series int, top: series float)Sets the left and top coordinates of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
left | series int | The new left coordinate (bar index or UNIX time). | |
top | series float | The new top coordinate (price). |
set_right
Box.set_right(id: series Box, right: series int)Sets the right coordinate of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
right | series int | The new right coordinate (bar index or UNIX time). |
set_rightbottom
Box.set_rightbottom(id: series Box, right: series int, bottom: series float)Sets the right and bottom coordinates of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
right | series int | The new right coordinate (bar index or UNIX time). | |
bottom | series float | The new bottom coordinate (price). |
set_text
Box.set_text(id: series Box, text: series string)Sets the text size of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text | series string | The new text content. |
set_text_color
Box.set_text_color(id: series Box, text_color: series color)Sets the text color of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_color | series color | The new text color. |
set_text_font_family
Box.set_text_font_family(id: series Box, font_family: series string)Sets the font family of the box text.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
font_family | series string | The font family: FontFamily.Default or FontFamily.Monospace. |
set_text_formatting
Box.set_text_formatting(id: series Box, text_formatting: const TextFormat)Sets the text formatting of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_formatting | const TextFormat | The text formatting options. |
set_text_halign
Box.set_text_halign(id: series Box, text_halign: series TextHAlign)Sets the horizontal alignment of the box text.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_halign | series TextHAlign | The horizontal text alignment: TextHAlign.Left, TextHAlign.Center, or TextHAlign.Right. |
set_text_size
Sets the text size of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_size | series int | The new text size in pixels. |
set_text_valign
Box.set_text_valign(id: series Box, text_valign: series TextVAlign)Sets the vertical alignment of the box text.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_valign | series TextVAlign | The vertical text alignment: TextVAlign.Top, TextHAlign.Center, or TextVAlign.Bottom. |
set_text_wrap
Box.set_text_wrap(id: series Box, text_wrap: series TextWrap)Sets the text wrapping mode of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
text_wrap | series TextWrap | The text wrapping mode: TextWrap.None or TextWrap.Auto. |
set_top
Box.set_top(id: series Box, top: series float)Sets the top coordinate of the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
top | series float | The new top coordinate (price). |
set_top_left_point
Box.set_top_left_point(id: series Box, point: series chart.Point)Sets the top-left corner of the box using a chart.Point object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
point | series chart.Point | The chart.Point object specifying the new top-left corner. |
set_xloc
Box.set_xloc(
id: series Box,
left: series int,
right: series int,
xloc: series Xloc
)Sets the left and right borders of a box and updates its xloc property.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
id | series Box | The box to modify. | |
left | series int | The new left coordinate (bar index or UNIX time). | |
right | series int | The new right coordinate (bar index or UNIX time). | |
xloc | series Xloc | The x-location type: Xloc.BarIndex or Xloc.BarTime. |