Skip to content
ChartDeck ChartScript docs Account Open the terminal

box

Boxes between two bars and two prices.

#Functions

#box.copyfunction

A new box with the same properties.

box.copy(id: box): box
ParameterTypeDescription
idboxThe array.

Returns box.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.

Example

ChartScriptFragmentOpen in editor
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
ParameterTypeDescription
idboxThe array.

Returns float.

Example

ChartScriptFragmentOpen in editor
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
ParameterTypeDescription
idboxThe array.

Returns int.

Example

ChartScriptFragmentOpen in editor
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
ParameterTypeDescription
idboxThe array.

Returns int.

Example

ChartScriptFragmentOpen in editor
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
ParameterTypeDescription
idboxThe array.

Returns float.

Example

ChartScriptFragmentOpen in editor
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 = "" }): box
box.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
ParameterTypeDescription
leftintThe left.
topfloatThe top.
rightintThe right.
bottomfloatThe bottom.
border_colorcolordefault color.blueThe border color.
border_widthintdefault 1The border width.
border_stylestringdefault line.style_solidThe border style.
extendstringdefault extend.noneThe extend.
xlocsimple stringdefault xloc.bar_indexThe xloc.
bgcolorcolordefault color.blueThe bgcolor.
textstringdefault ""Text drawn with the shape.
text_sizestringdefault size.autoThe text size.
text_colorcolordefault color.blackThe text color.
text_halignstringdefault text.align_centerThe text halign.
text_valignstringdefault text.align_centerThe text valign.
text_wrapstringdefault text.wrap_noneThe text wrap.
text_font_familystringdefault font.family_defaultThe text font family.
force_overlayconst booldefault falseAccepted and ignored in this version.
text_formattingintdefault text.format_noneThe text formatting.
lookconst 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_leftpointThe top left.
bottom_rightpointThe bottom right.

Returns box.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
colorcolorThe colour.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
colorcolorThe colour.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
stylestringThe style constant.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
widthintThe width.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
bottomfloatThe bottom.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
pointpointThe point.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
extendstringThe extend.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
leftintThe left.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
leftintThe left.
topfloatThe top.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
rightintThe right.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
rightintThe right.
bottomfloatThe bottom.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
textstringText drawn with the shape.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_colorcolorThe text color.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_font_familystringThe text font family.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_formattingintThe text formatting.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_halignstringThe text halign.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_sizestringThe text size.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_valignstringThe text valign.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
text_wrapstringThe text wrap.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
topfloatThe top.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
pointpointThe point.

Example

ChartScriptFragmentOpen in editor
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)
ParameterTypeDescription
idboxThe array.
leftintThe left.
rightintThe right.
xlocstringThe xloc.

Example

ChartScriptFragmentOpen in editor
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

ChartScriptFragmentOpen in editor
const n = array.size(box.all)

Since ChartScript 1

The ChartScript documentation is in English for now; translations will follow.