Description Usage Arguments Examples
View source: R/distribution_constraints.R
Add constraints to distributions
This method add the same distributions' constraint to each model in list
1 2 3 4 5 6 7 8 9 10 11 | addDistributionConstraint(this, paramset.label, expr, label)
## S3 method for class 'modelStrategy'
addDistributionConstraint(this, paramset.label, expr,
label)
## S3 method for class 'list'
addDistributionConstraint(this, ...)
## S3 method for class 'modelPortfolio'
addDistributionConstraint(this, ...)
|
this |
model |
paramset.label |
character, paramset label |
expr |
expression, that contains names from labels of distributions |
label |
character, name of the constraint |
... |
params for addDistribution |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
addIndicator(this, args = list(name = BBands, HLC = quote(spread), n = 20, sd = 1), as = 'bb',
lookback = 100)
addDistribution(this,
paramset.label = paramset,
component.type = 'indicator',
component.label = 'bb',
variable = list(sd = seq(0.5,3,0.05)),
label = 'bb.sd'
)
addRule(this, as = 'bb_up_dn',
condition = (Lag(spread,1) > Lag(bb[, 'up'],1)) &
(spread < bb[, 'up']) &
(spread > bb[, 'mavg']) &
(abs(spread - bb[ ,'mavg'])/spread > n) ,
type = 'enter',
args = list(n = 0.005),
side = -1,
oco = 'short',
osFun = stratbuilder2pub:::sameMoneyOs,
osFun_args = alist(amount = 5000000))
addDistribution(this,
paramset.label = paramset,
component.type = 'rule',
component.label = 'bb_up_dn',
variable = list(n = seq(0.005,0.03,0.002)),
label = 'my_distr'
)
addDistributionConstraint(this,
paramset.label = paramset,
expr = bb.sd > my_distr * 100
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.