Skip to main content

Class: Series

A bar-aligned series of f64 values owned by the host. Read it Pine-style: s[0] is the current bar, s[1] one bar back; out-of-range reads are na.

Three flavours share this type:

  • the framework's OHLCV + derived series (src.*),
  • indicator outputs: every ta.* call returns a Series, so ta.ema(ta.rsi(src.close, 14), 9) and rsi[1] both just work,
  • user series from series(), written with s[0] = value each bar.

Constructors​

Constructor​

new Series(id): Series

Parameters​

id​

i32

Returns​

Series

Properties​

id​

readonly id: i32

Accessors​

length​

Get Signature​

get length(): i32

Returns​

i32


value​

Get Signature​

get value(): f64

Current bar's value, same as s[0].

Returns​

f64

Methods​

at()​

at(back): f64

back bars ago (0 = current bar). na when out of range.

Parameters​

back​

i32

Returns​

f64


update()​

update(back, value): void

Write the current bar's value. Only user series (from series()) are writable and only index 0 (history is immutable); anything else traps.

Parameters​

back​

i32

value​

f64

Returns​

void