View source: R/genericStrategy.R
| addDistribution.Strategy | R Documentation |
Add distribution
## S3 method for class 'Strategy' addDistribution( this, component.type = "params", component.label = NULL, label, variable = list(), ... )
this |
Strategy |
component.type |
character, one of rule, indicator, params |
component.label |
character vector, name of component, argument |
label |
character, name for this distribution. It only needed if constraints will be used. This label will be used there as a name for this distribution. |
variable |
list, This field should be used if name if one of your params coincide with arguments of this function,
if not ... can be used. Each cell must have a name and include array, as |
... |
named array of params, as |
## Not run:
addIndicator(this, name = 'bb', expr = {
BBands(data$close[range, 1], n = n , sd = nsd)
}, args = list(n = 30, nsd = 1))
addDistribution(this,
component.type = 'indicator',
component.label = 'bb',
nsd = seq(0.5, 3, 0.05),
label = 'bb.sd'
)
addRule(this, name = 'bb_up_dn',
expr = (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),
block = 'short')
addDistribution(this,
component.type = 'rule',
component.label = 'bb_up_dn',
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.