Learn R Programming

quantstrat (version 0.16.7)

osMaxPos: order sizing function for position limits and level sizing

Description

levels are a simplification of more complex (proprietary) techniques sometimes used for order sizing. the max orderqty returned will be the limit/levels Obviously the strategy rules could ask for smaller order sizes, but this is the default. If you don't want to use levels, set them to 1.

Usage

osMaxPos(data, timestamp, orderqty, ordertype, orderside, portfolio,
  symbol, ruletype, digits = 0, ...)

Arguments

data

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

orderqty

numeric quantity of the desired order, modified by osFUN

ordertype

one of "market","limit","stoplimit", or "stoptrailing"

orderside

one of either "long" or "short"

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

ruletype

one of "risk","order","rebalance","exit","enter", see add.rule

digits

call round to round min/max clip size to specified number of digits after decimal place

...

any other passthru parameters

Details

orderqty='all' in a risk rule will return an order size appropriate to flatten the current position.

See Also

addPosLimit,getPosLimit