nCCI1 = 75; nCCI2 = 28; SL = 0.05; TS = 0.10
CCIpullback_SL_TS <- initiateStrategy("CCIpullback_SL_TS") %>%
addRule(.,
list(category = "condition",
indicator = TTR::CCI,
arguments = list(n = nCCI1, maType = "SMA", c = 0.015),
type = "on-off",
on = 100,
off = -100)
) %>%
addRule(.,
list(category = "condition",
indicator = TTR::CCI,
arguments = list(n = nCCI2, maType = "SMA", c = 0.015),
type = "on-off",
on = -100,
off = 100)
) %>%
addRule(.,
list(category = "buy_signal",
indicator = TTR::CCI,
arguments = list(n = nCCI2, maType = "SMA", c = 0.015),
type = "cross-up",
on = 0,
lag = 1)
) %>%
# addRule(.,
# list(category = "buy_condition",
# valid = 3,
# condition = '>Cl',
# spread = "spread")
# ) %>%
addRule(.,
list(category = "stop_loss",
stop_limit = list(type = "percent", level = SL), #last, "support"
stop_trailing = list(type = "percent", level = TS)#, #second-last, "support"
#stop_support = list(type = "support", thresh = SSL_thresh)
# stop_time = 50,
# stop_indicator = list(indicator = TTR::SMA,
# arguments = list(n = 150),
# type = "cross-down",
# on = -100),
# take_profit = list(type = "percent", level = 0.15)
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.