Description Usage Arguments Examples
View source: R/distribution_constraints.R
Add distribution
This method add the same distribution to each model in list
| 1 2 3 4 5 6 7 8 9 10 11 12 | addDistribution(this, paramset.label, component.type, component.label, variable,
  label)
## S3 method for class 'modelStrategy'
addDistribution(this, paramset.label, component.type,
  component.label, variable, label)
## S3 method for class 'list'
addDistribution(this, ...)
## S3 method for class 'modelPortfolio'
addDistribution(this, ...)
 | 
| this | model | 
| paramset.label | character, label of paramset, this argument can be missed | 
| component.type | character, one of the followng names: rule, indicator, params, lookback, lookforward, beta_fun | 
| component.label | character, name of component, argument 'as' is resposible for that. You can write multiple labels. If component.type is equal to one of lookback, lookforward, beta_fun, then this argument should be missed | 
| variable | list with only one element, for example list(n = 1:10) | 
| label | character, name for this distribution | 
| ... | 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 | ## Not run: 
addIndicator(this, args = list(name = BBands, HLC = quote(spread), n = 20, sd = 1), as = 'bb')
addDistribution(this,
    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'])  > n) ,
     type = 'enter',
     args = list(n = 0.005),
     side = -1,
     oco = 'short')
addDistribution(this,
    component.type = 'rule',
    component.label = 'bb_up_dn',
    variable = list(n = seq(0.005,0.03,0.002)),
    label = 'my_distr'
)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.