Usage
ruleSignal(mktdata = mktdata, timestamp, sigcol, sigval, orderqty = 0, ordertype, orderside = NULL, orderset = NULL, threshold = NULL, tmult = FALSE, replace = TRUE, delay = 0.0001, osFUN = "osNoOp", pricemethod = c("market", "opside", "active"), portfolio, symbol, ..., ruletype, TxnFees = 0, prefer = NULL, sethold = FALSE, label = "", order.price = NULL, chain.price = NULL, time.in.force = "")
Arguments
mktdata
an xts object containing market data.
depending on rules, may need to be in OHLCV or BBO
formats, and may include indicator and signal
information
timestamp
timestamp coercible to POSIXct that will
be the time the order will be inserted on
sigcol
column name to check for signal
sigval
signal value to match against
orderqty
numeric quantity of the desired order, or
one of 'all'/'trigger', modified by osFUN
ordertype
one of "market","limit","stoplimit",
"stoptrailing", or "iceberg"
orderside
one of either "long" or "short", default
NULL, see details
orderset
tag to identify an orderset; if one order
of the set is filled, all others are canceled
threshold
numeric or name of indicator column in
mktdata, default NULL, see Details
tmult
if TRUE, threshold is a percent multiplier
for price
, not a scalar. Threshold is converted to
a scalar by multiplying it with the price at the time of
order entry (i.e. the scalar will not change if the order
is updated, as in the case of a trailing stop), then it
is added to the price just like a scalar threshold.
replace
TRUE/FALSE, whether to replace any other
open order(s) on this portfolio symbol, default TRUE
delay
what delay to add to timestamp when
inserting the order into the order book, in seconds
osFUN
function or text descriptor of function to
use for order sizing, default osNoOp
pricemethod
determines how the order price will be
calculated, see Details
portfolio
text name of the portfolio to place
orders in
symbol
identifier of the instrument to place
orders for. The name of any associated price objects
(xts prices, usually OHLC) should match these
...
any other passthru parameters
ruletype
one of
"risk","order","rebalance","exit","entry", see
add.rule
TxnFees
numeric fees (usually negative) or
function name for calculating TxnFees (processing happens
later, not in this function)
prefer
price method for getPrice
sethold
boolean, puts entry Rule processing on
hold, default FALSE
order.price
the order price to use, will overrule
any mktdata lookup as well as chain.price (see below),
meant to specify eg. a stop-loss price that is unrelated
to the fill price (see chain.price)
chain.price
the price that the parent order got
filled for, used to pass to children in the order chain,
will overrule all mktdata lookup, only meant for internal
use really, default NULL
time.in.force
timestamp time-in-force; either a
time stamp, or a number of seconds, or 'GTC' / '', 'GTC'
and '' both meaning 'Good Till Canceled'; order expires
if still 'open' at this timestamp, default is ''