Skip to content
ChartDeck ChartScript docs Account Open the terminal

chart

The chart.

#Functions

#chart.point.copyfunction

A copy of the point.

chart.point.copy(id: point): point
ParameterTypeDescription
idpointThe array.

Returns point.

Example

ChartScriptFragmentOpen in editor
const p = chart.point.now(high)
const q = p.copy()

Since ChartScript 1

#chart.point.from_indexfunction

A point at a bar index.

chart.point.from_index(index: int, price: float): point
ParameterTypeDescription
indexintThe element index (negative counts from the end).
pricefloatThe price level.

Returns point.

Example

ChartScriptFragmentOpen in editor
const p = chart.point.from_index(bar_index, close)

Since ChartScript 1

#chart.point.from_timefunction

A point at a time.

chart.point.from_time(time: int, price: float): point
ParameterTypeDescription
timeintA time in milliseconds since 1970 (UTC).
pricefloatThe price level.

Returns point.

Example

ChartScriptFragmentOpen in editor
const p = chart.point.from_time(time, close)

Since ChartScript 1

#chart.point.newfunction

A point on the chart: a time, a bar index and a price (either x may be na).

chart.point.new(time: int, index: int, price: float): point
ParameterTypeDescription
timeintA time in milliseconds since 1970 (UTC).
indexintThe element index (negative counts from the end).
pricefloatThe price level.

Returns point.

Example

ChartScriptFragmentOpen in editor
const p = chart.point.new(time, bar_index, close)

Since ChartScript 1

#chart.point.nowfunction

A point on the current bar.

chart.point.now({ price?: float = close }): point
ParameterTypeDescription
pricefloatdefault closeThe price level.

Returns point.

Example

ChartScriptFragmentOpen in editor
const p = chart.point.now(high)

Since ChartScript 1

#Variables

#chart.bg_colorvariable

The chart background colour (a theme colour).

chart.bg_color: color

Type simple color.

Example

ChartScriptFragmentOpen in editor
const v = chart.bg_color

Since ChartScript 1

#chart.fg_colorvariable

The chart text colour (a theme colour).

chart.fg_color: color

Type simple color.

Example

ChartScriptFragmentOpen in editor
const v = chart.fg_color

Since ChartScript 1

#chart.is_heikinashivariable

true when the chart shows Heikin-Ashi candles.

chart.is_heikinashi: bool

Type simple bool.

Example

ChartScriptFragmentOpen in editor
const v = chart.is_heikinashi

Since ChartScript 1

#chart.is_standardvariable

true when the chart shows standard candles.

chart.is_standard: bool

Type simple bool.

Example

ChartScriptFragmentOpen in editor
const v = chart.is_standard

Since ChartScript 1

#chart.left_visible_bar_timevariable

The time of the leftmost visible bar (ms). The chart runs the script again when the view moves (at most a few times a second). na where there is no view: server runs (protected scripts, script alerts).

chart.left_visible_bar_time: int

Type series int.

Example

ChartScriptFragmentOpen in editor
const t = chart.left_visible_bar_time

Since ChartScript 1

#chart.right_visible_bar_timevariable

The time of the rightmost visible bar (ms; the last bar when the chart shows the present). Re-run when the view moves; na on server runs.

chart.right_visible_bar_time: int

Type series int.

Example

ChartScriptFragmentOpen in editor
const t = chart.right_visible_bar_time

Since ChartScript 1

#chart.themevariable

The chart theme: "dark", "light" or "hc" (the script re-runs when it changes).

chart.theme: string

Type simple string.

Example

ChartScriptFragmentOpen in editor
const v = chart.theme

Since ChartScript 1

#Constants

NameTypeDescription
chart.is_kagiboolAlways false: ChartDeck draws time-based bars.
chart.is_linebreakboolAlways false: ChartDeck draws time-based bars.
chart.is_pnfboolAlways false: ChartDeck draws time-based bars.
chart.is_rangeboolAlways false: ChartDeck draws time-based bars.
chart.is_renkoboolAlways false: ChartDeck draws time-based bars.

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