Options
All
• Public
• Public/Protected
• All

@thi.ng/transducers-stats

Functions

bollinger

• bollinger(period?: number, sd?: number): Transducer<number, BollingerBand>
• bollinger(src: Iterable<number>): IterableIterator<BollingerBand>
• bollinger(period: number, src: Iterable<number>): IterableIterator<BollingerBand>
• bollinger(period: number, sd: number, src: Iterable<number>): IterableIterator<BollingerBand>
• Computes Bollinger bands using sliding window.

https://en.wikipedia.org/wiki/Bollinger_Bands

Note: the number of results will be `period-1` less than the number of processed inputs.

-

-

Const bounds

• bounds(window: number[]): number[]
• Computes min / max values of given array.

-

donchian

• donchian(period: number): Transducer<number, [number, number]>
• donchian(period: number, src: Iterable<number>): IterableIterator<[number, number]>
• Computes Donchian channel, i.e. min/max values for sliding window.

https://en.wikipedia.org/wiki/Donchian_channel

Note: the number of results will be `period-1` less than the number of processed inputs.

-

Const dot

• dot(a: number[], b: number[]): number
• Computes dot product of 2 arrays. Assumes `a` and `b` are equal sized, but only considers length of `a`.

-

-

ema

• ema(period: number): Transducer<number, number>
• ema(period: number, src: Iterable<number>): IterableIterator<number>

hma

• hma(period: number): Transducer<number, any>
• hma(period: number, src: Iterable<number>): IterableIterator<number>

macd

• macd(fast?: number, slow?: number, smooth?: number): Transducer<number, MACD>
• macd(src: Iterable<number>): IterableIterator<MACD>
• macd(fast: number, slow: number, smooth: number, src: Iterable<number>): IterableIterator<MACD>
• Computes the Moving Average Convergence/Divergence (MACD) using given periods.

Note: the number of results will be `slow + smooth - 2` less than the number of processed inputs.

https://en.wikipedia.org/wiki/MACD

Parameters

• Optional fast: number

fast EMA period

• Optional slow: number

slow EMA period

• Optional smooth: number

signal smoothing EMA period

momentum

• momentum(period: number): Transducer<number, number>
• momentum(period: number, src: Iterable<number>): IterableIterator<number>

Note: the number of results will be `period` less than the number of processed inputs.

-

Const mse

• mse(window: number[], mean: number): number
• Computes mean square error of given array.

-

-

roc

• roc(period: number): Transducer<number, number>
• roc(period: number, src: Iterable<number>): IterableIterator<number>
• Rate of change.

https://en.wikipedia.org/wiki/Momentum_(technical_analysis)

Note: the number of results will be `period` less than the number of processed inputs and no outputs will be produced if there were less than `period` input values.

-

rsi

• rsi(period: number): Transducer<number, number>
• rsi(period: number, src: Iterable<number>): IterableIterator<number>
• Note: the number of results will be `period` less than the number of processed inputs.

-

sd

• sd(period?: number, scale?: number): Transducer<number, number>
• sd(src: Iterable<number>): IterableIterator<number>
• sd(period: number, scale: number, src: Iterable<number>): IterableIterator<number>
• Moving standard deviation, calculates mean square error to SMA and yields sequence of `sqrt(error / period)`.

https://en.wikipedia.org/wiki/Bollinger_Bands

Note: the number of results will be `period-1` less than the number of processed inputs.

-

-

sma

• sma(period: number): Transducer<number, number>
• sma(period: number, src: Iterable<number>): IterableIterator<number>
• Like {@link @thi.ng/transducers#(movingAverage:1)}, but using more efficient linked list as sliding window buffer.

Note: the number of results will be `period-1` less than the number of processed inputs.

-

stochastic

• stochastic(periodK?: number, periodD1?: number, periodD2?: number): Transducer<number, Stochastic>
• stochastic(src: Iterable<number>): IterableIterator<Stochastic>
• stochastic(periodK: number, periodD1: number, periodD2: number, src: Iterable<number>): IterableIterator<Stochastic>
• Stochastic oscillator. Yields tuples of `[%K, %D1, %D2]`, where:

• %K = (curr - L5) / (H5 - L5)
• %D1 = SMA(%K, periodD1)
• %D2 = SMA(%D1, periodD2)

https://en.wikipedia.org/wiki/Stochastic_oscillator

-

-

-

trix

• trix(period: number): Transducer<number, number>
• trix(period: number, src: Iterable<number>): IterableIterator<number>
• Note: the number of results will be `3 * (period - 1) + 1` less than the number of processed inputs.

-

wma

• wma(weights: number | number[]): Transducer<number, number>
• wma(weights: number | number[], src: Iterable<number>): IterableIterator<number>
• Note: the number of results will be `period-1` less than the number of processed inputs.

Parameters

• weights: number | number[]

period or array of weights

Returns IterableIterator<number>

Generated using TypeDoc