Learn R Programming

quantstrat (version 0.16.7)

setParameterConstraint: Function to construct parameter constraint object. (deprecated)

Description

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

Usage

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.

Examples

Run this code
# NOT RUN {
#(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')
# }
# NOT RUN {
#The object x then can be used as one of the inputs to applyParameter function to specify the
#constraints between parameters. 

# }

Run the code above in your browser using DataLab