| ml_prepare_features | R Documentation |
Constructs a minimal, leakage-safe set of tabular features commonly used
in cross-sectional ML: weekly momentum (12/26/52), RSI(14), distance from
20-week MA, and daily rolling volatility aligned to weekly dates
(tokens vol{N}d_walign, e.g., "vol20d_walign").
ml_prepare_features(
prices_weekly,
prices_daily = NULL,
include = c("mom12", "mom26", "mom52", "vol20d_walign", "dist20", "rsi14"),
interactions = NULL
)
prices_weekly |
Wide panel with |
prices_daily |
Optional wide panel (daily) if |
include |
Character vector of feature tokens to include. |
interactions |
Optional named list passed to |
All outputs are lagged by one period to avoid look-ahead in backtests.
A named list of panels (each a wide data.frame with Date).
## Not run:
X <- ml_prepare_features(sample_prices_weekly, sample_prices_daily,
include = c("mom12","vol20d_walign","rsi14"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.