I can't find in the Quantstrat documentation the definition of the add.rule arguments. I'm interested in knowing what is the difference between orderqty, tradeSize and maxSize.
Found the following related material on quantstrattrader:
The orderqty
argument applies only when there’s no osFUN
specified. It can take a flat value (E.G. 1, 2), or, when the rule type is “exit”, a quantity of “all”, to flatten a position.
The osFUN
specifies the order-sizing function to use. The osFUN
argument is actually a function object that gets passed in as an argument. If you do not wish to use an osFUN
, simply use a flat quantity, such as 100, or if using exit type orders, use “all” to flatten a position.
This is how an add.rule
function looks like:
add.rule(strategy.st, name = "ruleSignal",
arguments = list(sigcol = "longsig",
sigval = TRUE,
ordertype = "market",
prefer = "Open",
orderside = "long",
orderqty = 100,
replace = FALSE,
osFUN = osMaxPos,
tradeSize = 100,
maxSize = 100),
type = "enter")
Thank you.