Hi

I ran the following code (re-using the BBands.R demo file to test a simple
MACD) but it throws an error in the following way. I tried figuring out but
could not. Any assistances pls? dput(s) and str(s) as follows. Many thanks.


out<-try(applyStrategy(strategy='s' , portfolios='macd1'))
Error in list(x) : 'x' is missing

structure(list(name = "macd1", assets = NULL, indicators = list(
    structure(list(name = "MACD", label = "MACD.ind", enabled = TRUE,
        arguments = structure(list(Close = Close("IBM"), nFast = a,
            nSlow = b, nSig = c, maType = EMA), .Names = c("Close",
        "nFast", "nSlow", "nSig", "maType")), call = add.indicator(strategy
= s,
            name = "MACD", arguments = list(Close = quote(Close("IBM")),
                nFast = quote(a), nSlow = quote(b), nSig = quote(c),
                maType = quote(EMA)))), .Names = c("name", "label",
    "enabled", "arguments", "call"))), signals = list(structure(list(
    name = "sigCrossover", label = "macd.gt.signal", enabled = TRUE,
    arguments = structure(list(data = "IBM", columns = c("macd",
    "signal"), relationship = "gt", label = "macd.gt.signal"), .Names =
c("data",
    "columns", "relationship", "label")), call = add.signal(strategy = s,
        name = "sigCrossover", arguments = list(data = quote("IBM"),
            columns = c("macd", "signal"), relationship = "gt"),
        label = "macd.gt.signal")), .Names = c("name", "label",
"enabled", "arguments", "call")), structure(list(name = "sigCrossover",
    label = "macd.lt.signal", enabled = TRUE, arguments = structure(list(
        data = "IBM", columns = c("macd", "signal"), relationship = "lt",
        label = "macd.lt.signal"), .Names = c("data", "columns",
    "relationship", "label")), call = add.signal(strategy = s,
        name = "sigCrossover", arguments = list(data = quote("IBM"),
            columns = c("macd", "signal"), relationship = "lt"),
        label = "macd.lt.signal")), .Names = c("name", "label",
"enabled", "arguments", "call"))), rules = structure(list(risk = list(),
    order = list(), rebalance = list(), exit = list(), entry = list(),
    enter = list(structure(list(name = "ruleSignal", type = "enter",
        enabled = TRUE, label = "ruleSignal.rule", arguments =
structure(list(
            data = "IBM", sigcol = "macd.gt.signal", sigval = TRUE,
            orderqty = 100, ordertype = "market", orderside = NULL,
            threshold = NULL), .Names = c("data", "sigcol", "sigval",
        "orderqty", "ordertype", "orderside", "threshold")),
        path.dep = TRUE, call = add.rule(strategy = s, name = "ruleSignal",
            arguments = list(data = quote("IBM"), sigcol = "macd.gt.signal",

                sigval = TRUE, orderqty = 100, ordertype = "market",
                orderside = NULL, threshold = NULL), type = "enter")),
.Names = c("name",
    "type", "enabled", "label", "arguments", "path.dep", "call"
    ), class = "trade_rule"), structure(list(name = "ruleSignal",
        type = "enter", enabled = TRUE, label = "ruleSignal.rule",
        arguments = structure(list(data = "IBM", sigcol = "macd.lt.signal",
            sigval = TRUE, orderqty = -100, ordertype = "market",
            orderside = NULL, threshold = NULL), .Names = c("data",
        "sigcol", "sigval", "orderqty", "ordertype", "orderside",
        "threshold")), path.dep = TRUE, call = add.rule(strategy = s,
            name = "ruleSignal", arguments = list(data = quote("IBM"),
                sigcol = "macd.lt.signal", sigval = TRUE, orderqty = -100,
                ordertype = "market", orderside = NULL, threshold = NULL),
            type = "enter")), .Names = c("name", "type", "enabled",
    "label", "arguments", "path.dep", "call"), class = "trade_rule"))),
.Names = c("risk",
"order", "rebalance", "exit", "entry", "enter")), constraints = NULL,
    call = strategy(name = "macd1")), .Names = c("name", "assets",
"indicators", "signals", "rules", "constraints", "call"), class =
"strategy")

 str(s)
List of 7
 $ name       : chr "macd1"
 $ assets     : NULL
 $ indicators :List of 1
  ..$ :List of 5
  .. ..$ name     : chr "MACD"
  .. ..$ label    : chr "MACD.ind"
  .. ..$ enabled  : logi TRUE
  .. ..$ arguments:List of 5
  .. .. ..$ Close : language Close("IBM")
  .. .. ..$ nFast : symbol a
  .. .. ..$ nSlow : symbol b
  .. .. ..$ nSig  : symbol c
  .. .. ..$ maType: symbol EMA
  .. ..$ call     : language add.indicator(strategy = s, name = "MACD",
arguments = list(Close = quote(Close("IBM")),      nFast = quote(a), nSlow =
quote(b), nSig = quote(c), maType = quote(EMA)))
 $ signals    :List of 2
  ..$ :List of 5
  .. ..$ name     : chr "sigCrossover"
  .. ..$ label    : chr "macd.gt.signal"
  .. ..$ enabled  : logi TRUE
  .. ..$ arguments:List of 4
  .. .. ..$ data        : chr "IBM"
  .. .. ..$ columns     : chr [1:2] "macd" "signal"
  .. .. ..$ relationship: chr "gt"
  .. .. ..$ label       : chr "macd.gt.signal"
  .. ..$ call     : language add.signal(strategy = s, name = "sigCrossover",
arguments = list(data = quote("IBM"),      columns = c("macd", "signal"),
relationship = "gt"), label = "macd.gt.signal")
  ..$ :List of 5
  .. ..$ name     : chr "sigCrossover"
  .. ..$ label    : chr "macd.lt.signal"
  .. ..$ enabled  : logi TRUE
  .. ..$ arguments:List of 4
  .. .. ..$ data        : chr "IBM"
  .. .. ..$ columns     : chr [1:2] "macd" "signal"
  .. .. ..$ relationship: chr "lt"
  .. .. ..$ label       : chr "macd.lt.signal"
  .. ..$ call     : language add.signal(strategy = s, name = "sigCrossover",
arguments = list(data = quote("IBM"),      columns = c("macd", "signal"),
relationship = "lt"), label = "macd.lt.signal")
 $ rules      :List of 6
  ..$ risk     : list()
  ..$ order    : list()
  ..$ rebalance: list()
  ..$ exit     : list()
  ..$ entry    : list()
  ..$ enter    :List of 2
  .. ..$ :List of 7
  .. .. ..$ name     : chr "ruleSignal"
  .. .. ..$ type     : chr "enter"
  .. .. ..$ enabled  : logi TRUE
  .. .. ..$ label    : chr "ruleSignal.rule"
  .. .. ..$ arguments:List of 7
  .. .. .. ..$ data     : chr "IBM"
  .. .. .. ..$ sigcol   : chr "macd.gt.signal"
  .. .. .. ..$ sigval   : logi TRUE
  .. .. .. ..$ orderqty : num 100
  .. .. .. ..$ ordertype: chr "market"
  .. .. .. ..$ orderside: NULL
  .. .. .. ..$ threshold: NULL
  .. .. ..$ path.dep : logi TRUE
  .. .. ..$ call     : language add.rule(strategy = s, name = "ruleSignal",
arguments = list(data = quote("IBM"),      sigcol = "macd.gt.signal", sigval
= TRUE, orderqty = 100,  ...
  .. .. ..- attr(*, "class")= chr "trade_rule"
  .. ..$ :List of 7
  .. .. ..$ name     : chr "ruleSignal"
  .. .. ..$ type     : chr "enter"
  .. .. ..$ enabled  : logi TRUE
  .. .. ..$ label    : chr "ruleSignal.rule"
  .. .. ..$ arguments:List of 7
  .. .. .. ..$ data     : chr "IBM"
  .. .. .. ..$ sigcol   : chr "macd.lt.signal"
  .. .. .. ..$ sigval   : logi TRUE
  .. .. .. ..$ orderqty : num -100
  .. .. .. ..$ ordertype: chr "market"
  .. .. .. ..$ orderside: NULL
  .. .. .. ..$ threshold: NULL
  .. .. ..$ path.dep : logi TRUE
  .. .. ..$ call     : language add.rule(strategy = s, name = "ruleSignal",
arguments = list(data = quote("IBM"),      sigcol = "macd.lt.signal", sigval
= TRUE, orderqty = -100,  ...
  .. .. ..- attr(*, "class")= chr "trade_rule"
 $ constraints: NULL
 $ call       : language strategy(name = "macd1")
 - attr(*, "class")= chr "strategy"




-- 
'Raghu'

	[[alternative HTML version deleted]]

