Expand description
Calculations on scalar series for built-in and host-defined studies.
Outputs retain the input length. Missing results are NaN; lengths of zero are
treated as one, except change, where zero means no change. Complete-window
calculations require finite inputs throughout the window. Recursive averages
skip non-finite inputs, emitting NaN there and retaining their previous state.
Functions§
- change
- Difference from
periodbars ago. Unavailable or non-finite endpoints yield NaN. - crossover
- True where
amoves from belowbto above it. Equal values retain the last unequal comparison, so a touch and return does not cross. Missing values break comparisons. Output hasa.len()entries; missingbentries are gaps. - crossunder
- True where
amoves from abovebto below it; otherwise ascrossover. - ema
- Exponential average with alpha
2 / (period + 1), seeded by the first finite value. - ema_sma
- Exponential average with alpha
2 / (period + 1), seeded by the mean of the firstperiodfinite values. Useful for nested averages with a full warm-up. - highest
- Highest value in the trailing window, including partial warm-up windows.
NaN never wins; an all-NaN window yields negative infinity, as
f64::maxdoes. - lowest
- Lowest value in the trailing window, including partial warm-up windows.
NaN never wins; an all-NaN window yields positive infinity, as
f64::mindoes. - rma
- Wilder’s average with alpha
1 / period, seeded by the mean of the firstperiodfinite values. - sma
- Arithmetic mean of each complete trailing window.
- stdev
- Population standard deviation of each complete window, with divisor
period. - sum
- Sum of each complete trailing window, recovering after missing inputs leave it.
- wma
- Linear weighted mean of each complete window, weights
1..=period, newest heaviest.