setParameterConstraint: Function to construct parameter constraint object....

Description Usage Arguments Value Author(s) Examples

View source: R/parameters.R

Description

Function to construct parameter constraint object. The returned value will be one of the inputs to the applyParameter function.

Usage

1
2
setParameterConstraint(paramConstraintObj = list(), constraintLabel,
  paramList, relationship)

Arguments

paramConstraintObj

the ParameterConstraint object to be updated, if missing, funtion will create a new one.

constraintLabel

string label to apply to the constraint.

paramList

the two name of the prameters as a list contains two strings.

relationship

relationship between the 1st parameter and 2nd one. ('gt' means 1st parameter > 2nd parameter).

Value

The returned object is a structure contains the constraints on pairs of parameters, if the input argument 'paramConstraintObj' is provided, the function update the input paramConstraintObj object and return the updated one. When specify the constraints of several pairs of parameters, usually the first returned object is passed to the next several call of the function as input argument 'paramConstraintObj'. See example.

Author(s)

Yu Chen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#(For complete demo see parameterTestMACD.R)
#In a MACD strategy, we want to fast macd calcuated from less time periods (days)
#than slow macd signal:
## Not run:   
x<-setParameterConstraint(constraintLabel='macdPC',
     paramList=c('nFast','nSlow'),relationship='lt')

## End(Not run)
#The object x then can be used as one of the inputs to applyParameter function to specify the
#constraints between parameters. 

cloudcell/quantstrat documentation built on May 13, 2019, 8:03 p.m.