wickra exposes the
Wickra technical-analysis library in R over its C ABI hub. Every
indicator is a constructor returning a wickra_indicator;
you feed it data one observation at a time with update()
(an O(1) streaming step) or run a whole series at once with
batch(). Both paths share the exact same Rust core, so a
live feed and a historical backtest compute identical values.
library(wickra)
#>
#> Attaching package: 'wickra'
#> The following object is masked from 'package:stats':
#>
#> HoltWintersThe package ships a small synthetic OHLCV series,
sample_ohlcv, for examples (a seeded random walk — not real
market data).
head(sample_ohlcv)
#> date open high low close volume
#> 1 2023-01-02 99.67 102.11 99.03 101.69 2008760
#> 2 2023-01-03 101.70 102.07 100.25 101.04 1170273
#> 3 2023-01-04 100.68 101.52 100.54 101.52 1338059
#> 4 2023-01-05 101.58 102.39 101.51 102.33 1119735
#> 5 2023-01-06 102.73 103.17 101.79 102.87 741723
#> 6 2023-01-07 102.55 102.86 102.43 102.78 835901Scalar indicators run over a vector with batch(). Warmup
positions are NA.
The same indicator fed tick-by-tick with update()
returns the identical values — an equivalence the test suite enforces
for every indicator.
sma_stream <- Sma(20)
streamed <- vapply(sample_ohlcv$close, function(p) update(sma_stream, p), numeric(1))
same_warmup <- all(is.na(streamed) == is.na(sma_values))
same_values <- all(streamed == sma_values, na.rm = TRUE)
c(batch_equals_streaming = same_warmup && same_values)
#> batch_equals_streaming
#> TRUEA typical streaming loop reacts to each value as it arrives:
Indicators with several outputs return a named numeric
vector (NA while warming up). MACD is the classic example —
line, signal, and histogram:
Indicators that need the whole bar take the OHLCV fields plus a timestamp:
reset() returns an indicator to its warmup state so the
same object can be reused on a fresh series:
Sma(), Rsi(),
MacdIndicator(), Atr(), …) is listed in this
package’s help index.