osMaxPos | R Documentation |
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.
osMaxPos(
data,
timestamp,
orderqty,
ordertype,
orderside,
portfolio,
symbol,
ruletype,
digits = 0,
...
)
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 |
digits |
call |
... |
any other passthru parameters |
orderqty='all'
in a risk rule will return an order size
appropriate to flatten the current position.
TODO integrate orderqty='all' into osMaxPos for non-risk exit orders by combining side and pos for exits
addPosLimit
,getPosLimit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.