View source: R/technical_indicators.R
| calc_stochrsi | R Documentation |
Computes Stochastic RSI (%K) per column over a rolling window, returning
values in [0, 1]. For each symbol, RSI is computed with TTR::RSI() over
rsi_length periods; then StochRSI is
(RSI_t - \min RSI_{t-L+1:t}) / (\max RSI_{t-L+1:t} - \min RSI_{t-L+1:t}),
where L is stoch_length. If the range is zero the value is handled
per on_const_window (default "zero").
calc_stochrsi(
data,
length = 14L,
rsi_length = NULL,
stoch_length = NULL,
on_const_window = c("zero", "na")
)
data |
A |
length |
Integer lookback used when |
rsi_length |
Optional integer RSI lookback. Default: |
stoch_length |
Optional integer stochastic window. Default: |
on_const_window |
How to handle windows where |
A data.table with Date and symbol columns containing StochRSI
in [0, 1], with leading NAs for warmup.
TTR::RSI(), calc_momentum(), calc_moving_average(),
filter_top_n(), weight_by_risk_parity()
data(sample_prices_weekly)
s <- calc_stochrsi(sample_prices_weekly, length = 14)
head(s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.