sim.mae.strategy {matiming}R Documentation

Simulates the returns to the Moving Average Envelope (MAE) strategy

Description

This function simulates the returns to the MAE strategy

Usage

sim.mae.strategy(totret, rfret, dates, capret=NULL, tc=0, shorts = FALSE,
                        winsize=200, percentage=1, FUN=SMA)

Arguments

totret

the vector of total returns

rfret

the vector of risk-free returns

dates

the vector of dates

capret

the vector of capital gain returns

tc

the amount of one-way transaction costs (a scalar)

shorts

a logical value indicating the type of the strategy when a Sell signal is generated. If shorts=FALSE, money is just invested in cash; otherwise, the asset is sold short

winsize

a vector or a scalar that determines the size of the averaging window

percentage

a vector or a scalar that determines the envelope percentage

FUN

a function that determines the type of a moving average

Value

An object to be used by other functions. This object contains the returns to the simulated strategies and the description of each strategy (the type of a moving average, the sizes of the averaging windows, and the envelope percentages)

Note

The function FUN is either SMA, LMA, EMA, DMA, HMA or ZMA. The trading signal is computed using the vector of capital gain returns capret. If capret=NULL, then the trading signal is computed using the vector of total returns totret.

See Also

Other strategy simulation functions: sim.cdir.strategy(), sim.mac.strategy(), sim.macd.strategy(), sim.mom.strategy()

Examples

## Not run: 
data <- djia.monthly # use the monthly data for DJIA index
dates <- index(data)
data <- coredata(data)
capret <- data[,"CAP"]
totret <- data[,"TOT"]
rfret <- data[,"RF"]
tc <- 0.0025 # this defines 0.25% one-way transaction costs
winsize <- 2:20
percentage <- 0:10
shorts <- FALSE
results <- sim.mae.strategy(totret=totret, rfret=rfret, dates=dates,
                            capret=capret, tc=tc, winsize=winsize,
                            percentage=percentage, slow=slow, FUN=EMA)

## End(Not run)

[Package matiming version 1.0 Index]