View source: R/cross_sectional.R
| calc_relative_strength_rank | R Documentation |
Ranks each stock's indicator value against all other stocks on the same date. Enables relative strength strategies that adapt to market conditions. Optimized using matrix operations for 15x speedup.
calc_relative_strength_rank(
indicator_df,
method = c("percentile", "rank", "z-score")
)
indicator_df |
Data frame with Date column and indicator values |
method |
Ranking method: "percentile" (0-100), "rank" (1-N), or "z-score" |
Data frame with same structure containing ranks/scores
# Rank RSI across all stocks
data("sample_prices_weekly")
rsi <- calc_rsi(sample_prices_weekly, 14)
rsi_ranks <- calc_relative_strength_rank(rsi, method = "percentile")
# Find relatively overbought (top 10%)
relative_overbought <- filter_above(rsi_ranks, 90)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.