@pond-ts/process 0.64.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/API.md +181 -13
  2. package/CHANGELOG.md +1113 -1
  3. package/package.json +2 -2
package/API.md CHANGED
@@ -432,19 +432,166 @@ Series shapes (same file): `ChartSeries`, `BandSeries`, `BoxSeries`,
432
432
 
433
433
  All are pure `(series, options) → TimeSeries` appending output columns;
434
434
  `column` defaults to `'close'`; periods are bar counts; warm-up is
435
- length-preserving (`undefined` head rows).
436
-
437
- | Study | Output column(s) | Options gist | Source |
438
- | --------------------------- | ----------------------------------- | --------------------------------------------------- | -------------------------------------------------- |
439
- | `sma` | `sma` | `{ period, column?, output? }` | `packages/financial/src/studies/moving-average.ts` |
440
- | `ema` | `ema` | `{ period, column?, output? }` (α = 2/(period+1)) | `packages/financial/src/studies/moving-average.ts` |
441
- | `bollinger` | `bbMiddle`, `bbUpper`, `bbLower` | `{ period, stdDev?, column?, prefix? }` | `packages/financial/src/studies/bollinger.ts` |
442
- | `envelope` | `envMiddle`, `envUpper`, `envLower` | `{ period, percent?, maType?, column?, prefix? }` | `packages/financial/src/studies/envelope.ts` |
443
- | `rollingStdev` | `stdev` | `{ period, column?, output? }` (population, ddof=0) | `packages/financial/src/studies/rolling-stat.ts` |
444
- | `rollingMin` / `rollingMax` | `min` / `max` | `{ period, column?, output? }` (Donchian edges) | `packages/financial/src/studies/rolling-stat.ts` |
445
- | `rollingPercentile` | `p{q}` (e.g. `p90`) | `{ period, q, column?, output? }` | `packages/financial/src/studies/rolling-stat.ts` |
446
- | `zScore` | `zscore` | `{ period, column?, output? }` | `packages/financial/src/studies/z-score.ts` |
447
- | `percentChange` | `pctChange` | `{ periods?, column?, output? }` | `packages/financial/src/studies/percent-change.ts` |
435
+ length-preserving (`undefined` head rows). A **multi-input** study (`atr`,
436
+ `keltner`, `qstick`, `directionalMovement`, `vortex`) names each input instead of
437
+ taking one `column`, each
438
+ defaulting to its `DEFAULT_OHLCV` name the same "never hard-code a column"
439
+ rule applied per input (`relativeVigorIndex` names all four OHLC columns). A
440
+ study whose centre line is the caller's own field
441
+ appends only the bands (`atrBands`: no `Middle`), since the middle is already
442
+ on the series.
443
+
444
+ | Study | Output column(s) | Options gist | Source |
445
+ | --------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
446
+ | `sma` | `sma` | `{ period, column?, output? }` | `packages/financial/src/studies/moving-average.ts` |
447
+ | `ema` | `ema` | `{ period, column?, output? }` (α = 2/(period+1)) | `packages/financial/src/studies/moving-average.ts` |
448
+ | `movingAverage` | `ma` | `{ period, type?, column?, output? }` — the shared `MaType` menu (default `'sma'`) | `packages/financial/src/studies/moving-average.ts` |
449
+ | `bollinger` | `bbMiddle`, `bbUpper`, `bbLower` | `{ period, stdDev?, column?, prefix? }` | `packages/financial/src/studies/bollinger.ts` |
450
+ | `envelope` | `envMiddle`, `envUpper`, `envLower` | `{ period, percent?, maType?, column?, prefix? }` | `packages/financial/src/studies/envelope.ts` |
451
+ | `rollingStdev` | `stdev` | `{ period, column?, output? }` (population, ddof=0) | `packages/financial/src/studies/rolling-stat.ts` |
452
+ | `rollingMin` / `rollingMax` | `min` / `max` | `{ period, column?, output? }` (one edge; `donchian` gives the channel) | `packages/financial/src/studies/rolling-stat.ts` |
453
+ | `rollingPercentile` | `p{q}` (e.g. `p90`) | `{ period, q, column?, output? }` | `packages/financial/src/studies/rolling-stat.ts` |
454
+ | `zScore` | `zscore` | `{ period, column?, output? }` | `packages/financial/src/studies/z-score.ts` |
455
+ | `percentChange` | `pctChange` | `{ periods?, column?, output? }` (= ROC; TA-Lib-verified) | `packages/financial/src/studies/percent-change.ts` |
456
+ | `rsi` | `rsi` | `{ period?, column?, output? }` (Wilder, default 14) | `packages/financial/src/studies/rsi.ts` |
457
+ | `macd` | `macdLine`, `macdSignal`, `macdHist` | `{ fastPeriod?, slowPeriod?, signalPeriod?, column?, prefix? }` (12/26/9) | `packages/financial/src/studies/macd.ts` |
458
+ | `atr` | `atr` | `{ period?, high?, low?, close?, output? }` (Wilder, default 14) | `packages/financial/src/studies/atr.ts` |
459
+ | `momentum` | `momentum` | `{ period?, column?, output? }` (`v − v[−period]`, default 10) | `packages/financial/src/studies/momentum.ts` |
460
+ | `historicalVolatility` | `hv` | `{ period?, annualize?, column?, output? }` (σ of log returns, ×√252) | `packages/financial/src/studies/volatility.ts` |
461
+ | `stochastic` | `stochK`, `stochD` | `{ kPeriod?, slowing?, dPeriod?, high?, low?, close?, prefix? }` (14/3/3; `slowing: 1` = fast) | `packages/financial/src/studies/stochastic.ts` |
462
+ | `williamsR` | `williamsR` | `{ period?, high?, low?, close?, output? }` (default 14, bounded −100..0) | `packages/financial/src/studies/williams-r.ts` |
463
+ | `donchian` | `dcUpper`, `dcLower`, `dcMiddle` | `{ period?, high?, low?, prefix? }` (default 20) | `packages/financial/src/studies/donchian.ts` |
464
+ | `obv` | `obv` | `{ close?, volume?, output? }` (no period; TA-Lib seed `volume[0]`) | `packages/financial/src/studies/obv.ts` |
465
+ | `vwap` | `vwap` | `{ period, high?, low?, close?, volume?, output? }` (rolling, typical px) | `packages/financial/src/studies/vwap.ts` |
466
+ | `keltner` | `kcMiddle`, `kcUpper`, `kcLower` | `{ period?, atrPeriod?, multiplier?, maType?, high?, low?, close?, prefix? }` (modern variant: EMA(20) of typical price ± 2·ATR(10)) | `packages/financial/src/studies/keltner.ts` |
467
+ | `atrBands` | `atrbUpper`, `atrbLower` | `{ period?, multiplier?, column?, high?, low?, close?, prefix? }` (14/2; **no middle** — it is `column`) | `packages/financial/src/studies/atr-bands.ts` |
468
+ | `qstick` | `qstick` | `{ period?, maType?, open?, close?, output? }` (MA of `close − open`, default 8/sma) | `packages/financial/src/studies/qstick.ts` |
469
+ | `trix` | `trix`, `trixSignal` | `{ period?, signalPeriod?, column?, prefix? }` (1-bar % ROC of EMA³, 15/9; the line takes the prefix itself) | `packages/financial/src/studies/trix.ts` |
470
+ | `coppock` | `coppock` | `{ longPeriod?, shortPeriod?, wmaPeriod?, column?, output? }` (WMA of ROC₁₄+ROC₁₁, 14/11/10 — monthly by convention) | `packages/financial/src/studies/coppock.ts` |
471
+ | `priceOscillator` | `priceOsc` | `{ fastPeriod?, slowPeriod?, maType?, mode?, column?, output? }` (12/26/ema, percent = PPO, `mode: 'absolute'` = APO) | `packages/financial/src/studies/price-oscillator.ts` |
472
+ | `disparityIndex` | `disparity` | `{ period?, maType?, column?, output? }` (`100·(price − MA)/MA`, default 14/sma) | `packages/financial/src/studies/disparity-index.ts` |
473
+ | `detrendedPriceOscillator` | `dpo` | `{ period?, maType?, column?, output? }` (`price − MA[i − ⌊period/2⌋−1]`, default 20/sma) | `packages/financial/src/studies/detrended-price-oscillator.ts` |
474
+ | `elderRay` | `elderBull`, `elderBear` | `{ period?, high?, low?, close?, prefix? }` (`high/low − EMA(close)`, default 13) | `packages/financial/src/studies/elder-ray.ts` |
475
+ | `awesomeOscillator` | `ao` | `{ fastPeriod?, slowPeriod?, high?, low?, output? }` (SMA 5 − SMA 34 of `(high+low)/2`) | `packages/financial/src/studies/awesome-oscillator.ts` |
476
+ | `accumulationDistribution` | `ad` | `{ high?, low?, close?, volume?, output? }` (no period; cumulative CLV·volume, = TA-Lib `AD`) | `packages/financial/src/studies/accumulation-distribution.ts` |
477
+ | `chaikinOscillator` | `chaikinOsc` | `{ fastPeriod?, slowPeriod?, high?, low?, close?, volume?, output? }` (EMA 3 − EMA 10 of A/D, = TA-Lib `ADOSC`) | `packages/financial/src/studies/chaikin-oscillator.ts` |
478
+ | `priceVolumeTrend` | `pvt` | `{ close?, volume?, output? }` (no period; cumulative fractional-change·volume; bar 0 undefined) | `packages/financial/src/studies/price-volume-trend.ts` |
479
+ | `chaikinMoneyFlow` | `cmf` | `{ period?, high?, low?, close?, volume?, output? }` (Σ CLV·vol / Σ vol over 20, bounded −1..+1) | `packages/financial/src/studies/chaikin-money-flow.ts` |
480
+ | `moneyFlowIndex` | `mfi` | `{ period?, high?, low?, close?, volume?, output? }` (RSI form on typical-price·volume, default 14, = TA-Lib `MFI`) | `packages/financial/src/studies/money-flow-index.ts` |
481
+ | `forceIndex` | `force` | `{ period?, close?, volume?, output? }` (EMA of Δclose·volume, Elder's 13; `period: 1` is the raw force) | `packages/financial/src/studies/force-index.ts` |
482
+ | `easeOfMovement` | `eom` | `{ period?, maType?, scale?, high?, low?, volume?, output? }` (Arms' box ratio, 14/sma/1e8; quadratic in price) | `packages/financial/src/studies/ease-of-movement.ts` |
483
+ | `volumeOscillator` | `volOsc` | `{ fastPeriod?, slowPeriod?, maType?, volume?, output? }` (5/10/sma; `priceOscillator` percent-mode over volume) | `packages/financial/src/studies/volume-oscillator.ts` |
484
+ | `chandeMomentum` | `cmo` | `{ period?, column?, output? }` (Chande's **unsmoothed** up/down sums, default 14 — _not_ TA-Lib's CMO, which is `2·rsi − 100`) | `packages/financial/src/studies/chande-momentum.ts` |
485
+ | `ultimateOscillator` | `uo` | `{ shortPeriod?, mediumPeriod?, longPeriod?, high?, low?, close?, output? }` (7/14/28 weighted 4/2/1; TA-Lib `ULTOSC`) | `packages/financial/src/studies/ultimate-oscillator.ts` |
486
+ | `commodityChannelIndex` | `cci` | `{ period?, high?, low?, close?, output? }` (`(tp − SMA)/(0.015 · meanAbsDev)`, default 20; TA-Lib `CCI`) | `packages/financial/src/studies/commodity-channel-index.ts` |
487
+ | `intradayMomentumIndex` | `imi` | `{ period?, open?, close?, output? }` (RSI's form over `close − open`, **plain** sums, default 14) | `packages/financial/src/studies/intraday-momentum-index.ts` |
488
+ | `relativeVigorIndex` | `rvi`, `rviSignal` | `{ period?, open?, high?, low?, close?, prefix? }` (SWMA `(1,2,2,1)/6` body/range sums + SWMA signal, default 10) | `packages/financial/src/studies/relative-vigor-index.ts` |
489
+ | `psychologicalLine` | `psy` | `{ period?, column?, output? }` (percent of **up** closes, strict `>`, default 12) | `packages/financial/src/studies/psychological-line.ts` |
490
+ | `directionalMovement` | `dmiPlusDi`, `dmiMinusDi`, `dmiDx`, `dmiAdx`, `dmiAdxr` | `{ period?, high?, low?, close?, prefix? }` (Wilder's DMS — `+DI`/`−DI`/`DX`/`ADX`/`ADXR`, default 14; per-column warm-up; Wilder's seed, so a decaying transient vs TA-Lib) | `packages/financial/src/studies/directional-movement.ts` |
491
+ | `aroon` | `aroonUp`, `aroonDown`, `aroonOsc` | `{ period?, high?, low?, prefix? }` (`100·(period − bars since extreme)/period` over a **`period + 1`**-bar window, default 25; = TA-Lib `AROON`/`AROONOSC`) | `packages/financial/src/studies/aroon.ts` |
492
+ | `vortex` | `viPlus`, `viMinus` | `{ period?, high?, low?, close?, prefix? }` (`Σ\|H − prevL\| / Σ TR` and `Σ\|L − prevH\| / Σ TR`, default 14; positive, not bounded by 1) | `packages/financial/src/studies/vortex.ts` |
493
+ | `chaikinVolatility` | `chaikinVol` | `{ period?, rocPeriod?, high?, low?, output? }` (percent ROC of EMA(`high − low`), 10/10; **plain** range) | `packages/financial/src/studies/chaikin-volatility.ts` |
494
+ | `massIndex` | `mass` | `{ emaPeriod?, sumPeriod?, high?, low?, output? }` (Σ EMA(range)/EMA² over 25, Dorsey's 9/25; a **sum**, reads ≈ `sumPeriod`) | `packages/financial/src/studies/mass-index.ts` |
495
+ | `choppinessIndex` | `chop` | `{ period?, high?, low?, close?, output? }` (`100·log10(ΣTR/(HH−LL))/log10(period)`, default 14, bounded 0..100; `period ≥ 2`) | `packages/financial/src/studies/choppiness-index.ts` |
496
+ | `ulcerIndex` | `ulcer` | `{ period?, column?, output? }` (RMS % drawdown from the rolling peak, StockCharts' rolling form, default 14; warm-up `2·period−2`) | `packages/financial/src/studies/ulcer-index.ts` |
497
+ | `verticalHorizontalFilter` | `vhf` | `{ period?, column?, output? }` ((HH−LL)/Σ\|Δcolumn\| over 28, Adam White's; a **fraction** in (0, 1], warm-up `period`) | `packages/financial/src/studies/vertical-horizontal-filter.ts` |
498
+ | `gopalakrishnanRangeIndex` | `gapo` | `{ period?, high?, low?, output? }` (`ln(HH−LL)/ln(period)` = log base `period` of the range, default 10; `period ≥ 2`) | `packages/financial/src/studies/gopalakrishnan-range-index.ts` |
499
+ | `relativeVolatilityIndex` | `relVol` | `{ period?, stdevPeriod?, column?, output? }` (RSI's form on σ, Wilder-smoothed, Dorsey's 14/10 — **not** `rvi`, see below) | `packages/financial/src/studies/relative-volatility-index.ts` |
500
+ | `linearRegression` | `linregValue`, `linregSlope`, `linregIntercept`, `linregAngle`, `linregR2` | `{ period?, column?, prefix? }` (one rolling OLS fit against the bar index, default 14, `period ≥ 2`; `Value` = TA-Lib `LINEARREG`, `Intercept` = the fit at the window's **first** bar, `Angle` = degrees and **scale-dependent**) | `packages/financial/src/studies/linear-regression.ts` |
501
+ | `timeSeriesForecast` | `tsf` | `{ period?, column?, output? }` (the same fit one bar **past** the window, default 14; = TA-Lib `TSF`; deliberately not a `MaType`) | `packages/financial/src/studies/time-series-forecast.ts` |
502
+ | `chandeForecastOscillator` | `cfo` | `{ period?, column?, output? }` (`100·(price − TSF)/price`, default 14; scale-invariant, **not** shift-invariant) | `packages/financial/src/studies/chande-forecast-oscillator.ts` |
503
+ | `centerOfGravity` | `cog` | `{ period?, column?, output? }` (Ehlers' position-weighted balance point, default 10; **negative**, in `[−period, −1]` on positive prices, flat reads `−(period+1)/2` — TradingView's uncentred convention) | `packages/financial/src/studies/center-of-gravity.ts` |
504
+ | `correlation` | `corr` | `{ period?, column?, benchmark, output? }` (Pearson r of two columns over 30 bars, = TA-Lib `CORREL`; `benchmark` is a **column on the same joined series**, required) | `packages/financial/src/studies/correlation.ts` |
505
+ | `beta` | `beta` | `{ period?, column?, benchmark, output? }` (slope of `column`'s 1-bar returns on `benchmark`'s over 5 bars, = TA-Lib `BETA(benchmark, column)`; pass **prices**, returns taken inside) | `packages/financial/src/studies/beta.ts` |
506
+ | `priceRelative` | `priceRel` | `{ column?, benchmark, output? }` (`column / benchmark`, no period — ChartIQ's Price Relative / Relative Strength **comparative**; not `rsi`) | `packages/financial/src/studies/price-relative.ts` |
507
+ | `performanceIndex` | `perf` | `{ period?, column?, benchmark, output? }` (each side's own `period`-bar growth, divided; 1 = parity, default 20; `(x−1)·100` == `percentChange(priceRelative)`) | `packages/financial/src/studies/performance-index.ts` |
508
+ | `guppy` | `gmmaS3`…`gmmaS15`, `gmmaL30`…`gmmaL60` | `{ column?, type?, prefix? }` (Guppy's GMMA — the **fixed** twelve averages, short 3/5/8/10/12/15, long 30/35/40/45/50/60, default `ema`; the lists ship as `GUPPY_SHORT_PERIODS` / `GUPPY_LONG_PERIODS`) | `packages/financial/src/studies/guppy.ts` |
509
+ | `rainbow` | `rainbow1`…`rainbow10` | `{ column?, period?, type?, prefix? }` (Widner's Rainbow — ten **recursive** averages, each smoothing the previous; default period 2 / `sma`; stage `k` warms up at `k·(period−1)`) | `packages/financial/src/studies/rainbow.ts` |
510
+ | `rainbowOscillator` | `rbo`, `rboUpper`, `rboLower` | `{ column?, period?, lookback?, type?, prefix? }` (ChartIQ's — `100·(price − mean of the ten)/(HH−LL)` with the stack's own width as mirrored bands; default 2 / 10) | `packages/financial/src/studies/rainbow.ts` |
511
+ | `kst` | `kst`, `kstSignal` | `{ column?, signalPeriod?, prefix? }` (Pring's Know Sure Thing — ROC 10/15/20/30 smoothed 10/10/10/15, weighted 1/2/3/4; the twelve numbers are **not** options, only the signal SMA is, default 9) | `packages/financial/src/studies/kst.ts` |
512
+ | `priceMomentumOscillator` | `pmo`, `pmoSignal` | `{ column?, prefix? }` (DecisionPoint's PMO — two stages of **custom** `α = 2/n` smoothing over a 1-bar percent ROC, ×10, with a **span** EMA(10) signal; no period options) | `packages/financial/src/studies/price-momentum-oscillator.ts` |
513
+ | `stochasticRsi` | `stochRsiK`, `stochRsiD` | `{ column?, rsiPeriod?, stochPeriod?, kPeriod?, dPeriod?, prefix? }` (the stochastic construction over the RSI, 14/14/3/3; `stochRsiK` == TA-Lib `STOCHRSI`'s **fastd**, `stochRsiD` has no TA-Lib counterpart) | `packages/financial/src/studies/stochastic-rsi.ts` |
514
+ | `trueStrengthIndex` | `tsi`, `tsiSignal` | `{ column?, longPeriod?, shortPeriod?, signalPeriod?, prefix? }` (Blau's TSI — `100·EMA(EMA(Δ,long),short)/EMA(EMA(\|Δ\|,long),short)`, 25/13/7; bounded −100…100, long applied **first**) | `packages/financial/src/studies/true-strength-index.ts` |
515
+ | `movingAverageDeviation` | `maDev` | `{ period?, maType?, column?, output? }` (`price − MA`, in **price units**, default 20/sma — the points half of the pair whose percent half IS `disparityIndex`; no `mode` flag) | `packages/financial/src/studies/moving-average-deviation.ts` |
516
+ | `parabolicSar` | `psar`, `psarTrend` | `{ step?, maxStep?, high?, low?, prefix? }` (Wilder's stop-and-reverse, defaults 0.02 / 0.2; **= TA-Lib `SAR` exactly**; `Trend` is `+1` long / `−1` short — the stop can print ON an extreme, so the side is not derivable from the value) | `packages/financial/src/studies/parabolic-sar.ts` |
517
+ | `superTrend` | `st`, `stTrend` | `{ period?, multiplier?, high?, low?, close?, prefix? }` (Seban's ratcheting ATR band as TradingView's `ta.supertrend`, defaults 10 / 3; `st` **is** the live band, so the bands are not emitted; the seed side is DOWN) | `packages/financial/src/studies/super-trend.ts` |
518
+ | `atrTrailingStop` | `ats`, `atsTrend` | `{ period?, multiplier?, high?, low?, close?, prefix? }` (close-anchored ratcheting stop, Vervoort's, defaults 14 / 3; a close exactly ON the stop flips **short**; the Chandelier anchor is `donchian` + `atr`, not a knob) | `packages/financial/src/studies/atr-trailing-stop.ts` |
519
+ | `negativeVolumeIndex` | `nvi` | `{ column?, volume?, output?, start? }` (Fosback: compound the close return only on a **lower**-volume bar, base 1000; no period, no warm-up; a **flat** volume holds on both indices) | `packages/financial/src/studies/volume-index.ts` |
520
+ | `positiveVolumeIndex` | `pvi` | `{ column?, volume?, output?, start? }` (the same on a **higher**-volume bar) | `packages/financial/src/studies/volume-index.ts` |
521
+ | `klinger` | `kvo`, `kvoSignal` | `{ fastPeriod?, slowPeriod?, signalPeriod?, high?, low?, close?, volume?, prefix? }` (Klinger's ORIGINAL volume force through an EMA pair, defaults 34 / 55 / 13; **F-AMBIG** — TradingView's simplified `ta.kvo` is a different indicator) | `packages/financial/src/studies/klinger.ts` |
522
+ | `typicalPrice` | `typicalPrice` | `{ high?, low?, close?, output? }` (`(h+l+c)/3` = TA-Lib `TYPPRICE`, exact; **no warm-up**) | `packages/financial/src/studies/price-transform.ts` |
523
+ | `medianPrice` | `medianPrice` | `{ high?, low?, output? }` (`(h+l)/2` = `MEDPRICE`, exact; `close` on the shared options type is ignored) | `packages/financial/src/studies/price-transform.ts` |
524
+ | `weightedClose` | `weightedClose` | `{ high?, low?, close?, output? }` (`(h+l+2c)/4` = `WCLPRICE`, exact) | `packages/financial/src/studies/price-transform.ts` |
525
+ | `averagePrice` | `averagePrice` | `{ open?, high?, low?, close?, output? }` (`(o+h+l+c)/4` = `AVGPRICE`, exact — the only transform that reads the open) | `packages/financial/src/studies/price-transform.ts` |
526
+ | `balanceOfPower` | `bop` | `{ period?, maType?, open?, high?, low?, close?, output? }` (`(c−o)/(h−l)`, bounded −1…1; **raw by default** = TA-Lib `BOP` exact, `period` gives ChartIQ's smoothed form; a flat bar is `0`; `maType` without `period` throws) | `packages/financial/src/studies/balance-of-power.ts` |
527
+ | `starcBands` | `starcMiddle`, `starcUpper`, `starcLower` | `{ period?, atrPeriod?, multiplier?, maType?, high?, low?, close?, prefix? }` (Stoller: MA(**close**) ± mult·ATR, 20 / 15 / 2 / sma — the close-centred sibling of `keltner`'s typical-price centre) | `packages/financial/src/studies/starc-bands.ts` |
528
+ | `highLowBands` | `hlbMiddle`, `hlbUpper`, `hlbLower` | `{ period?, percent?, maType?, high?, low?, prefix? }` (MA(**median price**) × (1 ± percent%), 10 / 1% / trima; it **is** `envelope` over a `medianPrice` column — same `percent`, same units; ChartIQ labels the knob "shift") | `packages/financial/src/studies/high-low-bands.ts` |
529
+ | `bollingerBandwidth` | `bbWidth` | `{ period?, stdDev?, column?, output? }` (`100·(upper − lower)/middle`, 20 / 2 — the **×100** StockCharts form; a flat window is `0`, not missing; a zero-centre window — flat at zero or zero-mean — is missing) | `packages/financial/src/studies/bollinger-derived.ts` |
530
+ | `bollingerPercentB` | `percentB` | `{ period?, stdDev?, column?, output? }` (`(price − lower)/(upper − lower)`, 20 / 2 — the **decimal** form, unbounded; a flat window is a genuine `0/0` → missing) | `packages/financial/src/studies/bollinger-derived.ts` |
531
+ | `primeNumberBands` | `pnbUpper`, `pnbLower` | `{ high?, low?, prefix? }` (smallest prime ≥ high / largest ≤ low — a step function of the price LEVEL, no warm-up; a price below 2 is outside the domain; cost grows with price magnitude) | `packages/financial/src/studies/prime-number.ts` |
532
+ | `primeNumberOscillator` | `pno` | `{ column?, output? }` (`price − nearestPrime(price)`, signed; a tie goes to the **lower** prime; no warm-up; neither scale- nor shift-invariant) | `packages/financial/src/studies/prime-number.ts` |
533
+ | `marketFacilitationIndex` | `bwmfi` | `{ high?, low?, volume?, output? }` (Bill Williams' `(h−l)/volume`, raw — **`bwmfi`, not `mfi`**, which `moneyFlowIndex` owns; zero volume → missing, flat bar → `0`) | `packages/financial/src/studies/market-facilitation-index.ts` |
534
+ | `twiggsMoneyFlow` | `tmf` | `{ period?, high?, low?, close?, volume?, output? }` (Twiggs: CMF rebuilt on the **true** range and Wilder-smoothed, default 21; bounded −1…1; **F-AMBIG** — the window-sum form is 0.0706 away; warm-up `period`, and an interior gap ends it) | `packages/financial/src/studies/twiggs-money-flow.ts` |
535
+ | `tradeVolumeIndex` | `tvi` | `{ minTick, column?, volume?, output? }` (tick-direction accumulation; `minTick` — the instrument's minimum tick — is **required**; an undecided bar keeps the LAST direction, no first direction is invented, base 0, no warm-up; an interior gap **ends** the level, `obv`'s rule) | `packages/financial/src/studies/trade-volume-index.ts` |
536
+ | `shinoharaIntensityRatio` | `sirStrong`, `sirWeak` | `{ period?, open?, high?, low?, close?, prefix? }` (Shinohara's A and B ratios, `100·Σup/Σdown` over 26 bars — A against the bar's own open, B against the previous close; **F-AMBIG** on which is charted "strong"; neither is bounded and B inverts on a gappy tape; per-column warm-up 25 / 26) | `packages/financial/src/studies/shinohara-intensity-ratio.ts` |
537
+ | `elderImpulse` | `impulse` | `{ emaPeriod?, fastPeriod?, slowPeriod?, signalPeriod?, column?, output? }` (Elder: `+1` when EMA(13) **and** the MACD histogram both rise, `−1` when both fall, `0` otherwise — a **numeric** column, `withColumn` has no string door; ties are `0`; warm-up 34) | `packages/financial/src/studies/elder-impulse.ts` |
538
+ | `movingAverageCross` | `maCross` | `{ fastPeriod?, slowPeriod?, maType?, column?, output? }` (a **signal** column: `+1` on the bar the fast MA crosses above the slow, `−1` below, `0` otherwise — the averages themselves are `movingAverage`'s; an exact tie is no cross and a touch-and-retreat is no cross; `maType`, not `type`; warm-up `slowPeriod`) | `packages/financial/src/studies/moving-average-cross.ts` |
539
+ | `anchoredVwap` | `avwap` | `{ anchor, high?, low?, close?, volume?, output? }` (cumulative `Σ tp·vol / Σ vol` from the first bar **at or after** `anchor` — a `Date` or epoch ms, **required**; earlier bars `undefined`; an interior gap ends the line, `obv`'s rule; the session-reset form waits on [PND-TCAL]) | `packages/financial/src/studies/anchored-vwap.ts` |
540
+ | `stochasticMomentumIndex` | `smi`, `smiSignal` | `{ period?, longPeriod?, shortPeriod?, signalPeriod?, high?, low?, close?, prefix? }` (Blau's SMI — the close against the **midpoint** of the HH/LL range, double-EMA smoothed above and below, ×100; Blau's 13 / 25 / 2 / 3; bounded −100…100) | `packages/financial/src/studies/stochastic-momentum-index.ts` |
541
+ | `fisherTransform` | `fisher`, `fisherSignal` | `{ period?, high?, low?, prefix? }` (Ehlers' transform of the **median price's** own range position, default 10; the `0.33/0.67`, `±0.99→±0.999` clamp and `0.5/0.5` constants are Ehlers', not options; the signal is the line delayed one bar) | `packages/financial/src/studies/fisher-transform.ts` |
542
+ | `schaffTrendCycle` | `stc` | `{ fastPeriod?, slowPeriod?, cyclePeriod?, column?, output? }` (Schaff's double stochastic of a MACD with a fixed `0.5` smoothing between, 23 / 50 / 10, bounded 0…100; a pinned first stochastic leaves the second window flat → `undefined`) | `packages/financial/src/studies/schaff-trend-cycle.ts` |
543
+ | `prettyGoodOscillator` | `pgo` | `{ period?, column?, high?, low?, close?, output? }` (Johnson's `(close − SMA)/EMA(TR)`, default 14, in average-daily-ranges; **F-AMBIG** — the Wilder-ATR denominator port is a different study, measured) | `packages/financial/src/studies/pretty-good-oscillator.ts` |
544
+ | `swingIndex` | `si` | `{ limit, open?, high?, low?, close?, output? }` (Wilder 1978; `limit` — the instrument's limit move — is **required**, there being no defensible default; bounded −100…100 at a `limit` above the largest gap; `R = 0` → `undefined`) | `packages/financial/src/studies/swing-index.ts` |
545
+ | `accumulativeSwingIndex` | `asi` | `{ limit, open?, high?, low?, close?, output? }` (the running total of `swingIndex`; a running sum, so an interior gap — a halted bar pair included — ends it) | `packages/financial/src/studies/swing-index.ts` |
546
+ | `randomWalkIndex` | `rwiHigh`, `rwiLow` | `{ period?, high?, low?, close?, prefix? }` (Poulos: the max over horizons `2 … period` of `(high − low[−n])/(meanTR(n)·√n)`, default 14; the **`n`-bar mean** TR, not Wilder's ATR; O(N·period), and it goes negative) | `packages/financial/src/studies/random-walk-index.ts` |
547
+ | `ravi` | `ravi` | `{ shortPeriod?, longPeriod?, column?, output? }` (Chande: `100·\|SMA(7) − SMA(65)\|/SMA(65)`; **absolute**, so it answers "is there a trend", not "which way"; trending above 3%) | `packages/financial/src/studies/ravi.ts` |
548
+ | `trendIntensityIndex` | `tii` | `{ period?, maPeriod?, column?, output? }` (M. H. Pee: `100·Σpos/(Σpos + Σneg)` of the deviations from an SMA, 30 / 60, bounded 0…100; **F-AMBIG** — the count form is a different study; warm-up 88) | `packages/financial/src/studies/trend-intensity-index.ts` |
549
+ | `specialK` | `specialK` | `{ column?, output? }` (Pring's extended KST — twelve weighted smoothed ROCs across three groups; the thirty-six constants ARE the study, so there are no period options; **warm-up 724 bars**) | `packages/financial/src/studies/special-k.ts` |
550
+
551
+ **The two-series family takes a benchmark COLUMN, never a second
552
+ `TimeSeries`.** `correlation`, `beta`, `priceRelative` and `performanceIndex`
553
+ each name their comparison series with a required `benchmark` column on the
554
+ series they are given — the consumer aligns and joins first
555
+ (`series.align(seq)` + `TimeSeries.joinMany([...], { type: 'inner' })`), which
556
+ is where the alignment policy belongs. A `benchmark` (or `column`) that is not
557
+ on the series **throws**. `RollingBivariateMoments` is the kernel's return type.
558
+
559
+ Every study also exports its options type (`SmaOptions`-style, named for the
560
+ study). `PriceOscillatorMode` (`'percent' | 'absolute'`) is exported alongside
561
+ `PriceOscillatorOptions` — `packages/financial/src/studies/price-oscillator.ts`.
562
+
563
+ **The K6 state machines append `${prefix}` and `${prefix}Trend`.**
564
+ `parabolicSar`, `superTrend` and `atrTrailingStop` each emit their value under
565
+ the **bare** prefix (not `${prefix}Line` — the study _is_ one number, and
566
+ `psar()` must leave a column called `psar`) plus a `${prefix}Trend` of `+1` /
567
+ `−1`, `+1` meaning the line sits **below** price. The side is a separate
568
+ column because it is not recoverable from the value: all three clamp, so the
569
+ line can print exactly on an extreme or on the close, and a strict comparison
570
+ would then draw it on the wrong side.
571
+
572
+ **Two studies are called "RVI".** `relativeVigorIndex` (Ehlers' body/range
573
+ ratio) keeps the `rvi` prefix; `relativeVolatilityIndex` (Dorsey's RSI-on-σ)
574
+ appends **`relVol`**, so both can sit on one series with no `output` juggling.
575
+
576
+ **Two studies are called "MFI", and the same rule applies.**
577
+ `moneyFlowIndex` (Quong & Soudack's RSI-on-money-flow) keeps `mfi` because it
578
+ shipped first; `marketFacilitationIndex` (Bill Williams' `(h−l)/volume`, an
579
+ entirely different indicator) appends **`bwmfi`** — the author's initials in
580
+ front of the abbreviation, which is what MetaTrader calls it for the same
581
+ reason. Both can sit on one series.
582
+
583
+ **The two prime studies are the only operators here whose cost depends on the
584
+ MAGNITUDE of the data**, not its length: primality is trial division to `√n`,
585
+ so the per-bar cost grows with the price level. Measured at 1M bars:
586
+ `primeNumberBands` 78 ms at ~1e2 prices and **6.5 s** at ~1e7;
587
+ `primeNumberOscillator` 55 ms and **6.5 s**. There is no sieve — see
588
+ `packages/financial/src/kernels/prime.ts` for why, and for what would change
589
+ that.
590
+
591
+ **Volume Rate of Change is `percentChange({ column: 'volume' })`** — the corpus
592
+ names it separately, but the formula is identical (and TA-Lib-verified through
593
+ `ROC`), so there is no `volumeRateOfChange` study. A test in
594
+ `test/studies.test.ts` pins the recipe.
448
595
 
449
596
  Adding a study? Follow `packages/financial/src/studies/README.md` (uniform
450
597
  shape + pandas oracle case + fluent method are all REQUIRED).
@@ -466,6 +613,27 @@ shape + pandas oracle case + fluent method are all REQUIRED).
466
613
  `packages/financial/src/contract/`. `RollingReducer` (reducer-name union used
467
614
  by studies) — `packages/financial/src/kernels/rolling.ts`.
468
615
 
616
+ ### Moving-average engine (kernel K2)
617
+
618
+ | Export | Purpose | Source |
619
+ | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
620
+ | `MaType` | The MA-type vocabulary: `'sma' \| 'ema' \| 'wma' \| 'smma' \| 'dema' \| 'tema' \| 'trima' \| 'hull' \| 'kama' \| 'zlema'` | `packages/financial/src/kernels/moving-average.ts` |
621
+ | `MA_TYPES` | The same menu as a readonly array (validation, fan-out over every type) | `packages/financial/src/kernels/moving-average.ts` |
622
+ | `movingAverageValues(v, period, type)` | One MA over a raw `Float64Array` — for studies whose input is derived (Keltner's typical price, Coppock's WMA of ROCs, the Price Oscillator) | `packages/financial/src/kernels/moving-average.ts` |
623
+ | `percentChangeValues(v, periods)` | Percent change vs `periods` bars ago (×100) over a raw `Float64Array` — the ROC every rate-of-change study composes on (`percentChange`, `trix`, `coppock`) | `packages/financial/src/kernels/rate-of-change.ts` |
624
+ | `directionalMovementValues(high, low)` | Wilder's `+DM` / `−DM` split from one pass — the per-bar term of the whole `ADX` family (`directionalMovement`); the file also holds the vortex's crossing legs | `packages/financial/src/kernels/directional-movement.ts` |
625
+ | `barsSinceExtremeValues(v, period, mode)` | **Bars since** the max/min of a `period + 1`-bar window (ties to the newest bar), via a monotonic deque — O(N), flat in `period`; the corpus's G3 argmax gap (`aroon`) | `packages/financial/src/kernels/highest-lowest.ts` |
626
+ | `linearRegressionValues(v, period)` | Kernel **K7**: the rolling OLS fit against the bar index — `{ slope, intercept, r2 }` in one O(N) pass, flat in `period`, shifted-frame; `period ≥ 2` (`linearRegression`, `timeSeriesForecast`, `chandeForecastOscillator`) | `packages/financial/src/kernels/linear-regression.ts` |
627
+ | `linearRegressionAt(fit, x)` | Project a `RollingRegression` to bar offset `x` from the window's first bar — `intercept + slope·x` per row; `period − 1` is the window's last bar (`LINEARREG`), `period` one bar past it (`TSF`) | `packages/financial/src/kernels/linear-regression.ts` |
628
+ | `rollingBivariateValues(x, y, period)` | Rolling population covariance + each column's variance over a **strict** pair window (shifted-frame Welford, rebuilt every `period` rows) — the K8 primitive `correlation` and `beta` divide; validates `period ≥ 2` | `packages/financial/src/kernels/bivariate.ts` |
629
+ | `foldRows(inputs, n, state, step)` | Kernel **K6**: a per-bar fold with carried state over several row-aligned columns — one O(N·k) pass, `n` NaN-filled outputs, the state mutated in place. A missing cell **resets** the machine (`run` restarts at 1); `FoldStep` is the step's type. The corpus's G2 gap, exported from `@pond-ts/financial` like the other kernels; not promoted to core until a consumer earns a `scanRows` there | `packages/financial/src/kernels/fold.ts` |
630
+
631
+ `MovingAverageTypeOptions` (the `movingAverage` study's options: the shared
632
+ `MovingAverageOptions` plus `type`) —
633
+ `packages/financial/src/studies/moving-average.ts`. `RollingRegression` (the
634
+ `{ slope, intercept, r2 }` triple `linearRegressionValues` returns) —
635
+ `packages/financial/src/kernels/linear-regression.ts`.
636
+
469
637
  ---
470
638
 
471
639
  ## @pond-ts/fit