/** * The lookback averages: `sma`, `wma`, `swma` and `vwma`. * * Each is a fresh accumulation over the lookback in index order, oldest bar * first, for the reason `lookback.ts` sets out: a sum has an order as well as a * value, and a running total that subtracts the bar leaving the lookback is a * different number. * * Each is written once, as a step over a state region, and its tail is that * step over a region of its own. An engine calls the same step against the * region it holds for the call site, so there is no second arrangement of the * arithmetic anywhere for the two to drift apart in. */ import type { Series, StateRecord, Tail, Value } from '../values/index.js'; /** A bar's source value paired with its volume, for the volume weighted forms. */ export interface Weighted { readonly src: Value; readonly volume: Value; } /** `sma(src, len)`: the arithmetic mean of the last `len` values, from bar `len - 1`. */ export declare function smaStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `sma(src, len)` as a tail. */ export declare function smaTail(len: number): Tail; /** `sma(src, len)` over a whole series. */ export declare function sma(src: Series, len: number): Value[]; /** * `wma(src, len)`: linearly weighted, the newest value weighted `len`, from bar * `len - 1`. * * `stdlib.md` section 4 fixes the weights and not the order they are summed in, * so the order is this library's own and is the one stated in `lookback.ts`: * oldest bar first, which is weight 1 first and weight `len` last. */ export declare function wmaStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `wma(src, len)` as a tail. */ export declare function wmaTail(len: number): Tail; /** `wma(src, len)` over a whole series. */ export declare function wma(src: Series, len: number): Value[]; /** `swma(src)`: the fixed four bar symmetric mean, weights 1, 2, 2, 1 over 6, from bar 3. */ export declare function swmaStep(state: StateRecord, key: string, value: Value): Value; /** `swma(src)` as a tail. */ export declare function swmaTail(): Tail; /** `swma(src)` over a whole series. */ export declare function swma(src: Series): Value[]; /** * `vwma(src, len)`: the mean weighted by each bar's volume, from bar `len - 1`. * * The total of `src * volume` over the total of `volume`, which is what "mean * weighted by volume" says. Dividing two means by `len` first and then dividing * one by the other is the same quantity with two extra roundings in it, and * this is the arrangement without them. */ export declare function vwmaStep(state: StateRecord, key: string, input: Weighted, len: number | null): Value; /** `vwma(src, len)` as a tail. */ export declare function vwmaTail(len: number): Tail; /** `vwma(src, len)` over a whole series. */ export declare function vwma(src: Series, volume: Series, len: number): Value[]; //# sourceMappingURL=simple.d.ts.map