backtest-functions: User defined functions to perform portfolio backtesting

backtest-functionsR Documentation

User defined functions to perform portfolio backtesting

Description

Default windows, strategy and smoothing functions used for portfolio backtesting.

Usage

equidistWindows(data, backtest = portfolioBacktest())

tangencyStrategy(data, spec = portfolioSpec(), constraints = "LongOnly", 
    backtest = portfolioBacktest())
    
emaSmoother(weights, spec, backtest)

Arguments

data

a multivariate time series described by an S4 object of class timeSeries. If your timeSerie is not a timeSeries object, consult the generic function as.timeSeries to convert your time series.

backtest

an S4 object of class fPFOLIOBACKTEST as returned by the function portfolioBacktest.

spec

an S4 object of class fPFOLIOSPEC as returned by the function portfolioSpec.

constraints

a character string vector, containing the constraints of the form
"minW[asset]=percentage" for box constraints resp.
"maxsumW[assets]=percentage" for sector constraints.

weights

a numeric vector, containing the portfolio weights of an asset

Details

equidistWindows:

Defines equal distant rolling windows.

The function requires two arguments: data and backtest, see above. To assign the horizon value to the backtest specification structure, use the function setWindowsHorizon.

tangencyStrategy:

A pre-defined tangency portfolio strategy.

The function requires four arguments: data, spec, constraints and backtest, see above.

emaSmoother:

A pre-defined weights smoother (EMA) for portfolio backtesting.

The function requires three arguments: weights, spec and backtest, see above. To assign initial starting weights, smoothing parameter (lambda) or whether to perform double smoothing to the backtest specification structure, use the functions setSmootherInitialWeights, setSmootherLambda and setSmootherDoubleSmoothing, respectively.

Value

equidistWindows
function returns the "from" and "to" dates of the rolling window in a list form.

tangencyStrategy
function returns a S4 object of class "fPORTFOLIO".

emaSmoother
function returns a numeric vector of smoothed weights.

References

W\"urtz, D., Chalabi, Y., Chen W., Ellis A. (2009); Portfolio Optimization with R/Rmetrics, Rmetrics eBook, Rmetrics Association and Finance Online, Zurich.


fPortfolio documentation built on Jan. 14, 2024, 8:21 p.m.