Learn R Programming

quantstrat (version 0.16.7)

apply.paramset.signal.analysis: Signal Analysis With Parmeter Optimization

Description

This function allows user to analyze signals independently from rules.

Usage

apply.paramset.signal.analysis(strategy.st, paramset.label, portfolio.st,
  sigcol, sigval, on, forward.days, cum.sum = TRUE,
  include.day.of.signal, obj.fun, decreasing = TRUE, mktdata = NULL,
  verbose = TRUE)

Arguments

strategy.st

an object of type 'strategy' to add the indicator to

paramset.label

a label uniquely identifying the paramset within the strategy

portfolio.st

text name of the portfolio to associate the order book with

sigcol

column name to check for signal

sigval

signal value to match against

on

the periods endpoints to find as a character string

forward.days

days to exit post signal

cum.sum

whether to use cumsum on price changes

include.day.of.signal

whether to include the day of signal generation

obj.fun

objective function for determining goodness of each paramset

decreasing

if TRUE (the default), larger objective function values are better

mktdata

market data

verbose

whether to output processing messages

Value

A list of objects that contains the results

signals

List of signals named by parameter combination. Each object within the list is a XTS object with columns being assets and rows being signals.

sigret.by.paramset

List of list. Sorted by parameter combination and then by asset. Contains matrix of next day returns; columns are period (N day look ahead) and rows are signals

sigret.by.asset

List of list. Sorted by Asset and then by parameter combinations. Contains same matrix as sigret.by.paramset

signal.stats

List of signal statistics as calculated via custom user defined fitness function. Sorted by assets.

Details

This function is similar to applyParameter but includes additionally applySignal wrapped within it. To use it, the user will need to initially define the distribution and constraints by using add.distribution and add.distribution.constraint.

More generally, the function is designed to generate signals across various parameter combinations defined within the distribution and constraints. Afterwards it extract the next N day price changes for further anlaysis.

The parameter on allows user to calculate post signal returns in different frequencies. Different signals have different timeframes effectiveness. forward.days lets the user select the number of post signal days to analyze results.

To determine the goodness of a parameter set relative to all others, we let the user specify their own objective function (via parameter obj.func) that will be used to calculate an objective value representing each parameter. These will then be sorted from best to worst. The objective function will take in a single matrix ret.mat of price changes. Each row represents an individual signal while each column represents periods/post signal.

See Also

add.distribution add.distribution.constraint