Options
All
  • Public
  • Public/Protected
  • All
Menu

@thi.ng/transducers-stats

Index

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>

Const bounds

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

    Parameters

    • window: number[]

      -

    Returns number[]

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.

    Parameters

    • period: number

      -

    Returns Transducer<number, [number, number]>

  • Parameters

    • period: number
    • src: Iterable<number>

    Returns IterableIterator<[number, number]>

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.

    Parameters

    • a: number[]

      -

    • b: number[]

      -

    Returns number

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

    Returns Transducer<number, MACD>

  • Parameters

    • src: Iterable<number>

    Returns IterableIterator<MACD>

  • Parameters

    • fast: number
    • slow: number
    • smooth: number
    • src: Iterable<number>

    Returns IterableIterator<MACD>

momentum

  • momentum(period: number): Transducer<number, number>
  • momentum(period: number, src: Iterable<number>): IterableIterator<number>
  • {@link en.wikipedia.org/wiki/Momentum_(technical_analysis)}

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

    Parameters

    • period: number

      -

    Returns Transducer<number, number>

  • Parameters

    • period: number
    • src: Iterable<number>

    Returns IterableIterator<number>

Const mse

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

    Parameters

    • window: number[]

      -

    • mean: number

      -

    Returns number

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.

    Parameters

    • period: number

      -

    Returns Transducer<number, number>

  • Parameters

    • period: number
    • src: Iterable<number>

    Returns IterableIterator<number>

rsi

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

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.

    Parameters

    • Optional period: number

      -

    • Optional scale: number

      -

    Returns Transducer<number, number>

  • Parameters

    • src: Iterable<number>

    Returns IterableIterator<number>

  • Parameters

    • period: number
    • scale: number
    • src: Iterable<number>

    Returns IterableIterator<number>

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.

    Parameters

    • period: number

      -

    Returns Transducer<number, number>

  • Parameters

    • period: number
    • src: Iterable<number>

    Returns IterableIterator<number>

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>

trix

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

wma

  • wma(weights: number | number[]): Transducer<number, number>
  • wma(weights: number | number[], src: Iterable<number>): IterableIterator<number>

Generated using TypeDoc