Msgstr "No.

When I use enable.rule, I cannot override the rule inside enabled=FALSE.

For instance:

## Stop Loss Rule
stratstocky <- add.rule(stratstocky,
                        name = "ruleSignal",
                        arguments = list(sigcol = "sdH", 
                                         sigval = TRUE,
                                         replace = FALSE,
                                         orderside = "long",
                                         ordertype = "stoptrailing",
                                         tmult = TRUE,
                                         threshold = quote(stopLossPercent),
                                         orderqty = "all",
                                         orderset = "ocolong"),
                        type = "chain",
                        parent = "getLong",
                        label = "StopTrailingLong",
                        enabled = FALSE
)

When I put this code before applyStrategy:

enable.rule(stratstocky, type="chain", "StopTrail", enable=TRUE)

The rule will not be activated or active. The only way to activate a rule is to change its internal one TRUE. I tried accurate spelling, but it does not work for me.

This is not a big problem, because I can simply parameterize the internal inclusion of the rule and manage it this way, but would prefer to use the existing code to run my system.

Any understanding of the problems enable.rule?

+4
source share
1 answer

, .

, store=TRUE store=FALSE

, add.rule store=FALSE, stratstocky enable.rule.

store=FALSE, enable.rule . , , , :

stratstocky <- enable.rule(stratstocky, type="chain", "StopTrail", enable=TRUE)

.

,

demo('macross',ask=FALSE)

. , , macross store=FALSE.

:

stratMACROSS <- enable.rule(stratMACROSS,type='exit',label='ruleSignal.rule',enable=FALSE)

,

stratMACROSS <- enable.rule(stratMACROSS,type='exit',label='ruleSignal.rule')

.

+5

Source: https://habr.com/ru/post/1568812/


All Articles