Functions

Volatility · trend

13 names in this group.
Each comes with its signature and an example.

ta.atr

Average true range (default 14)

signature
atr(length?: number): Series
example
ta.atr(14)

ta.tr

True range

signature
tr(): Series

ta.bb

Bollinger Bands (default 20, 2); width = (upper − lower) / mid

signature
bb(src: Source, length?: number, mult?: number): { upper: Series; mid: Series; lower: Series; width: Series }
example
const band = ta.bb(close, 20, 2)

ta.stdev

Standard deviation

signature
stdev(src: Source, length: number): Series

ta.bbw

Bollinger band width: (upper − lower) / mid

signature
bbw(src: Source, length?: number, mult?: number): Series

ta.kc

Keltner channels: EMA ± mult × the EMA of the true range (default 20, 2); useTrueRange false uses high − low

signature
kc(src: Source, length?: number, mult?: number, useTrueRange?: boolean): { upper: Series; mid: Series; lower: Series }
example
const k = ta.kc(close, 20, 2)

ta.kcw

Keltner channel width: (upper − lower) / mid

signature
kcw(src: Source, length?: number, mult?: number, useTrueRange?: boolean): Series

ta.sar

Parabolic SAR (default 0.02, 0.02, 0.2); below the price = uptrend

signature
sar(start?: number, inc?: number, max?: number): Series
example
plot('SAR', ta.sar(0.02, 0.02, 0.2), { style: 'cross' })

ta.ichimoku

Ichimoku conversion, base, span A and B (default 9, 26, 52), not shifted: plot the spans with offset: 25 (base − 1) and the lagging line as close with offset: -25

signature
ichimoku(conversion?: number, base?: number, spanB?: number): { conversion: Series; base: Series; spanA: Series; spanB: Series }
example
const ich = ta.ichimoku(9, 26, 52)

ta.pivots

Pivot points from the previous period's (anchor, default 'D') high, low and close, the same all through the current period; NaN in the first one

signature
pivots(type?: 'traditional' | 'fibonacci' | 'woodie' | 'classic' | 'camarilla', anchor?: Period | Bool): { p: Series; r1: Series; r2: Series; r3: Series; s1: Series; s2: Series; s3: Series }
example
const pv = ta.pivots('traditional', 'D')

ta.dmi

Directional movement: +DI, −DI and ADX

signature
dmi(length?: number, adxSmoothing?: number): { plus: Series; minus: Series; adx: Series }

ta.adx

ADX (trend strength)

signature
adx(length?: number, smoothing?: number): Series

ta.supertrend

SuperTrend (default 3, 10); dir 1 = up, −1 = down

signature
supertrend(factor?: number, atrLength?: number): { line: Series; dir: Series }
example
const st = ta.supertrend(3, 10)

npm · GitHub