chart
The chart.
#Functions
#chart.point.copyfunction
A copy of the point.
chart.point.copy(id: point): point| Parameter | Type | Description |
|---|---|---|
id | point | The array. |
Returns point.
Example
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| Parameter | Type | Description |
|---|---|---|
index | int | The element index (negative counts from the end). |
price | float | The price level. |
Returns point.
Example
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| Parameter | Type | Description |
|---|---|---|
time | int | A time in milliseconds since 1970 (UTC). |
price | float | The price level. |
Returns point.
Example
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| Parameter | Type | Description |
|---|---|---|
time | int | A time in milliseconds since 1970 (UTC). |
index | int | The element index (negative counts from the end). |
price | float | The price level. |
Returns point.
Example
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| Parameter | Type | Description |
|---|---|---|
price | floatdefault close | The price level. |
Returns point.
Example
const p = chart.point.now(high)Since ChartScript 1
#Variables
#chart.bg_colorvariable
The chart background colour (a theme colour).
chart.bg_color: colorType simple color.
Example
const v = chart.bg_colorSince ChartScript 1
#chart.fg_colorvariable
The chart text colour (a theme colour).
chart.fg_color: colorType simple color.
Example
const v = chart.fg_colorSince ChartScript 1
#chart.is_heikinashivariable
true when the chart shows Heikin-Ashi candles.
chart.is_heikinashi: boolType simple bool.
Example
const v = chart.is_heikinashiSince ChartScript 1
#chart.is_standardvariable
true when the chart shows standard candles.
chart.is_standard: boolType simple bool.
Example
const v = chart.is_standardSince 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: intType series int.
Example
const t = chart.left_visible_bar_timeSince 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: intType series int.
Example
const t = chart.right_visible_bar_timeSince ChartScript 1
#chart.themevariable
The chart theme: "dark", "light" or "hc" (the script re-runs when it changes).
chart.theme: stringType simple string.
Example
const v = chart.themeSince ChartScript 1
#Constants
| Name | Type | Description |
|---|---|---|
chart.is_kagi | bool | Always false: ChartDeck draws time-based bars. |
chart.is_linebreak | bool | Always false: ChartDeck draws time-based bars. |
chart.is_pnf | bool | Always false: ChartDeck draws time-based bars. |
chart.is_range | bool | Always false: ChartDeck draws time-based bars. |
chart.is_renko | bool | Always false: ChartDeck draws time-based bars. |