
Hi All:



I'm using the package quantstrat and trying (unsuccessfully) to use my own
function for order sizing. For example using
the demo example (faber.R), the first rule is:

s <- add.rule(s, name='ruleSignal', arguments = list(data=quote(mktdata),
sigcol="Cl.gt.SMA", sigval=TRUE, orderqty=1000, ordertype='market',
orderside='long', pricemethod='market'), type='enter', path.dep=TRUE)


Now I try and incorporate my own order sizing function:

myOS <- function(orderqty,...){

      orderqty <- orderqty[1]*orderqty[2]
      return(orderqty)
}

I modify the rule above:

s <- add.rule(s, name='ruleSignal', arguments = list(data=quote(mktdata),
sigcol="Cl.gt.SMA", sigval=TRUE, orderqty=c(1000,2), ordertype='market',
orderside='long', pricemethod='market'), osFUN="myOS", type='enter',
path.dep=TRUE)


When, I run the code I get a bunch of warnings and no trades are generated.
I suspect that I'm not passing the arguments the right way from the
"add.rule" function to the "myOs" function. I've tried lots of different
things with no success.
Any help would be much appreciated.

Thanks in advance,
Krish

-- 
View this message in context: http://r.789695.n4.nabble.com/quantstrat-order-sizing-question-tp2271635p2271635.html
Sent from the Rmetrics mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]

