Description Usage Arguments Value Functions
View source: R/portfolio_utils.R
We define the historical price mean MA_t at time t to be
MA_t = decay_factor \cdot p_t + (1-decay_factor) \cdot MA_{t-1}
And MA_1 = p_1.
1 2 3 4 5 6 7 | compute_historical_price_means(prices, decay_factor = 0.5, .check_input = TRUE)
compute_historical_price_mean_matrix(
price_matrix,
decay_factor = 0.5,
.check_input = TRUE
)
|
prices |
A vector of prices |
decay_factor |
the decay factor for the mean (see description) |
.check_input |
If |
price_matrix |
A matrix of prices, where each row represents a trading period and each column represents an asset |
A vector with the same dimension as prices
with historical price means as the entries
compute_historical_price_mean_matrix
: Computes a matrix of historical price means from a matrix
of prices, where each column represents an asset.
Ouptut has same column names as price_matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.