Learn R Programming

IKTrading (version 1.0)

osDollarATR: osDollarATR

Description

computes an order size by way of ATR quantities, as a proportion of tradeSize

Usage

osDollarATR(orderside, tradeSize, pctATR,
    maxPctATR = pctATR, data, timestamp, symbol,
    prefer = "Open", portfolio, integerQty = TRUE,
    atrMod = "", rebal = FALSE, ...)

Arguments

orderside
long or short
tradeSize
a notional dollar amount for the trade
pctATR
a percentage of the tradeSize to order in units of ATR. That is, if tradeSize is 10000 and pctATR is .02, then the amount ordered will be 200 ATRs of the security. If the last observed ATR is 2, then 100 units of the security will be ordered.
maxPctATR
an upper limit to how many ATRs can be held in a position; a risk limit
integerQty
an integer quantity of shares
atrMod
a string modifier in case of multiples of this indicator being used. Will append to the term 'atr', that is, atrMod of "X" will search for a term called 'atrX' in the column names of the mktdata xts object.
rebal
if TRUE, and current position exceeds ATR boundaries, will automatically sell