data("sample_prices_weekly")
mom <- calc_momentum(sample_prices_weekly, lookback = 12)
sel <- filter_top_n(mom, n = 10)
W <- weight_equally(sel)
res <- run_backtest(sample_prices_weekly, W)
print(res)
Run the code above in your browser using DataLab