box
Boxes between two bars and two prices.
#Functions
#box.copyfunction
A new box with the same properties.
box.copy(id: box): box| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Returns box.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
const b2 = bx.copy()Since ChartScript 1
#box.deletefunction
Removes the box.
box.delete(id: box)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.delete()Since ChartScript 1
#box.get_bottomfunction
The bottom edge.
box.get_bottom(id: box): float| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Returns float.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
const v = bx.get_bottom()Since ChartScript 1
#box.get_leftfunction
The left edge.
box.get_left(id: box): int| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Returns int.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
const v = bx.get_left()Since ChartScript 1
#box.get_rightfunction
The right edge.
box.get_right(id: box): int| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Returns int.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
const v = bx.get_right()Since ChartScript 1
#box.get_topfunction
The top edge.
box.get_top(id: box): float| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
Returns float.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
const v = bx.get_top()Since ChartScript 1
#box.newfunction
A box between two bars and two prices. The oldest is removed past max_boxes_count.
box.new(left: int, top: float, right: int, bottom: float, { border_color?: color = color.blue, border_width?: int = 1, border_style?: string = line.style_solid, extend?: string = extend.none, xloc?: simple string = xloc.bar_index, bgcolor?: color = color.blue, text?: string = "", text_size?: string = size.auto, text_color?: color = color.black, text_halign?: string = text.align_center, text_valign?: string = text.align_center, text_wrap?: string = text.wrap_none, text_font_family?: string = font.family_default, force_overlay?: const bool = false, text_formatting?: int = text.format_none, look?: const string = "" }): boxbox.new(top_left: point, bottom_right: point, { border_color?: color = color.blue, border_width?: int = 1, border_style?: string = line.style_solid, extend?: string = extend.none, xloc?: simple string = xloc.bar_index, bgcolor?: color = color.blue, text?: string = "", text_size?: string = size.auto, text_color?: color = color.black, text_halign?: string = text.align_center, text_valign?: string = text.align_center, text_wrap?: string = text.wrap_none, text_font_family?: string = font.family_default, force_overlay?: const bool = false, text_formatting?: int = text.format_none, look?: const string = "" }): box| Parameter | Type | Description |
|---|---|---|
left | int | The left. |
top | float | The top. |
right | int | The right. |
bottom | float | The bottom. |
border_color | colordefault color.blue | The border color. |
border_width | intdefault 1 | The border width. |
border_style | stringdefault line.style_solid | The border style. |
extend | stringdefault extend.none | The extend. |
xloc | simple stringdefault xloc.bar_index | The xloc. |
bgcolor | colordefault color.blue | The bgcolor. |
text | stringdefault "" | Text drawn with the shape. |
text_size | stringdefault size.auto | The text size. |
text_color | colordefault color.black | The text color. |
text_halign | stringdefault text.align_center | The text halign. |
text_valign | stringdefault text.align_center | The text valign. |
text_wrap | stringdefault text.wrap_none | The text wrap. |
text_font_family | stringdefault font.family_default | The text font family. |
force_overlay | const booldefault false | Accepted and ignored in this version. |
text_formatting | intdefault text.format_none | The text formatting. |
look | const stringdefault "" | A style made with style.box (its look, shared and user-editable). Without one the drawing still follows the Labels & text tab (size, font, dimming). |
top_left | point | The top left. |
bottom_right | point | The bottom right. |
Returns box.
Example
const bx = box.new(bar_index - 5, high, bar_index, low)Since ChartScript 1
#box.set_bgcolorfunction
Sets the fill colour.
box.set_bgcolor(id: box, color: color)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
color | color | The colour. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_bgcolor(color.new(color.blue, 80))Since ChartScript 1
#box.set_border_colorfunction
Sets the border colour.
box.set_border_color(id: box, color: color)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
color | color | The colour. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_border_color(color.red)Since ChartScript 1
#box.set_border_stylefunction
Sets the border dash style.
box.set_border_style(id: box, style: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
style | string | The style constant. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_border_style(line.style_dotted)Since ChartScript 1
#box.set_border_widthfunction
Sets the border width.
box.set_border_width(id: box, width: int)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
width | int | The width. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_border_width(2)Since ChartScript 1
#box.set_bottomfunction
Sets the bottom price.
box.set_bottom(id: box, bottom: float)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
bottom | float | The bottom. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_bottom(low)Since ChartScript 1
#box.set_bottom_right_pointfunction
Sets the bottom-right corner from a chart.point.
box.set_bottom_right_point(id: box, point: point)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
point | point | The point. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_bottom_right_point(chart.point.now(low))Since ChartScript 1
#box.set_extendfunction
Extends the box sideways (extend.*).
box.set_extend(id: box, extend: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
extend | string | The extend. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_extend(extend.right)Since ChartScript 1
#box.set_leftfunction
Sets the left bar.
box.set_left(id: box, left: int)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
left | int | The left. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_left(bar_index)Since ChartScript 1
#box.set_lefttopfunction
Sets the left bar and the top.
box.set_lefttop(id: box, left: int, top: float)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
left | int | The left. |
top | float | The top. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_lefttop(bar_index, high)Since ChartScript 1
#box.set_rightfunction
Sets the right bar.
box.set_right(id: box, right: int)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
right | int | The right. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_right(bar_index)Since ChartScript 1
#box.set_rightbottomfunction
Sets the right bar and the bottom.
box.set_rightbottom(id: box, right: int, bottom: float)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
right | int | The right. |
bottom | float | The bottom. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_rightbottom(bar_index, low)Since ChartScript 1
#box.set_textfunction
Sets the text.
box.set_text(id: box, text: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text | string | Text drawn with the shape. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text("zone")Since ChartScript 1
#box.set_text_colorfunction
Sets the text colour.
box.set_text_color(id: box, text_color: color)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_color | color | The text color. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_color(color.white)Since ChartScript 1
#box.set_text_font_familyfunction
Sets the font.
box.set_text_font_family(id: box, text_font_family: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_font_family | string | The text font family. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_font_family(font.family_monospace)Since ChartScript 1
#box.set_text_formattingfunction
Bold / italic (text.format_*).
box.set_text_formatting(id: box, text_formatting: int)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_formatting | int | The text formatting. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_formatting(text.format_italic)Since ChartScript 1
#box.set_text_halignfunction
Sets the horizontal text alignment.
box.set_text_halign(id: box, text_halign: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_halign | string | The text halign. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_halign(text.align_left)Since ChartScript 1
#box.set_text_sizefunction
Sets the text size.
box.set_text_size(id: box, text_size: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_size | string | The text size. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_size(size.small)Since ChartScript 1
#box.set_text_valignfunction
Sets the vertical text alignment.
box.set_text_valign(id: box, text_valign: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_valign | string | The text valign. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_valign(text.align_top)Since ChartScript 1
#box.set_text_wrapfunction
Wraps the text (text.wrap_auto) or not.
box.set_text_wrap(id: box, text_wrap: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
text_wrap | string | The text wrap. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_text_wrap(text.wrap_auto)Since ChartScript 1
#box.set_topfunction
Sets the top price.
box.set_top(id: box, top: float)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
top | float | The top. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_top(high)Since ChartScript 1
#box.set_top_left_pointfunction
Sets the top-left corner from a chart.point.
box.set_top_left_point(id: box, point: point)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
point | point | The point. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_top_left_point(chart.point.now(high))Since ChartScript 1
#box.set_xlocfunction
Sets both bars and how they are read.
box.set_xloc(id: box, left: int, right: int, xloc: string)| Parameter | Type | Description |
|---|---|---|
id | box | The array. |
left | int | The left. |
right | int | The right. |
xloc | string | The xloc. |
Example
const bx = box.new(bar_index - 5, high, bar_index, low)
bx.set_xloc(time, time, xloc.bar_time)Since ChartScript 1
#Variables
#box.allvariable
Every box of the script that still exists, oldest first.
box.all: array<box>Type series array<box>.
Example
const n = array.size(box.all)Since ChartScript 1