diff --git a/docs/wiki/indicators/trailing-stops/Indicator-Psar.md b/docs/wiki/indicators/trailing-stops/Indicator-Psar.md index 19e40b13..922196f4 100644 --- a/docs/wiki/indicators/trailing-stops/Indicator-Psar.md +++ b/docs/wiki/indicators/trailing-stops/Indicator-Psar.md @@ -72,13 +72,24 @@ impl Indicator for Psar { } ``` -- **Python streaming.** Returns `float | None`. +- **Python streaming.** `psar.update(candle)` returns `float | None`. - **Python batch.** `PSAR.batch(high, low, close)` returns a 1-D `np.ndarray`; the first row is `NaN` (warmup) and every subsequent row holds the SAR level for that bar. -- **Node streaming.** Not exposed in the Node binding. +- **Node streaming.** `psar.update(high, low, close)` returns `number | null`. - **Node batch.** `psar.batch(high, low, close)` returns `Array` with `NaN` for the first row. +- **WASM streaming.** `psar.update(high, low, close)` returns + `number | null` once warm. +- **WASM batch.** `psar.batch(high, low, close)` returns a + `Float64Array` with `NaN` for the first row. +- **`isReady` convention.** `psar.is_ready()` flips to `true` only once the + first non-`None` SAR has been produced (i.e. from the second candle + onwards). The first (seed) candle returns `None` and `is_ready()` stays + `false`, matching every other indicator in the library. Previous releases + flipped the flag after the seed candle even though it produced no value — + consumers that wrote `if psar.is_ready() { use(psar.update(c)?) }` would + hit an unexpected `None` on the first post-seed update; that's now fixed. ## Warmup diff --git a/docs/wiki/indicators/volatility-bands/Indicator-HistoricalVolatility.md b/docs/wiki/indicators/volatility-bands/Indicator-HistoricalVolatility.md index 1a162d99..e8f6517d 100644 --- a/docs/wiki/indicators/volatility-bands/Indicator-HistoricalVolatility.md +++ b/docs/wiki/indicators/volatility-bands/Indicator-HistoricalVolatility.md @@ -69,7 +69,12 @@ non-`None` output lands on input `period + 1`. log return; its standard deviation — and so HV — is `0` (`geometric_series_yields_zero` pins this). - **Non-positive prices.** A log return is undefined when either price is - `<= 0`; that return is treated as `0`. + `<= 0`. Such ticks are **skipped**: the previous valid value is returned, + the indicator's state (previous price, window, sums) is left untouched, and + the next real positive tick re-anchors against the previous *valid* price. + Previous releases silently treated bad ticks as a `0.0` log-return, which + underreported realised volatility on broken data feeds — that behaviour has + changed. - **Non-negative.** Volatility is a standard deviation and is never negative (`output_is_non_negative` pins this). - **NaN / infinity inputs.** Non-finite inputs are silently dropped.