Functions

Moving averages

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

ta.sma

Simple moving average

signature
sma(src: Source, length: number): Series
example
ta.sma(close, 20)

ta.ema

Exponential moving average (seeded with the SMA)

signature
ema(src: Source, length: number): Series
example
ta.ema(close, 20)

ta.rma

Wilder’s moving average (used by RSI, ATR)

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

ta.wma

Weighted moving average

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

ta.vwma

Volume-weighted moving average

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

ta.hma

Hull moving average

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

ta.dema

Double EMA (2·EMA − EMA of the EMA)

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

ta.tema

Triple EMA

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

ta.linreg

Least-squares regression value (LSMA); offset reads that many bars back

signature
linreg(src: Source, length: number, offset?: number): Series
example
ta.linreg(close, 25, 0)

ta.alma

Arnaud Legoux moving average (default offset 0.85, sigma 6)

signature
alma(src: Source, length: number, offset?: number, sigma?: number): Series
example
ta.alma(close, 9, 0.85, 6)

ta.swma

Symmetrically weighted average of the last 4 values (1/6, 2/6, 2/6, 1/6)

signature
swma(src: Source): Series

ta.vwap

Volume-weighted average price, starting over at each anchor: 'D' (day, default), 'W', 'M', 'Y' in the market's time zone (crypto UTC, Korean stocks Seoul), or a condition (from the bars where it is true). src defaults to hlc3

signature
vwap(src?: Source, anchor?: Period | Bool): Series
example
ta.vwap(hlc3, 'D')

ta.vwapbands

VWAP with bands at ± mult × the volume-weighted standard deviation (default 1)

signature
vwapbands(src?: Source, anchor?: Period | Bool, mult?: number): { vwap: Series; upper: Series; lower: Series }
example
const v = ta.vwapbands(hlc3, 'W', 2)

npm · GitHub