Skip to content
Prev 7833 / 15274 Next

quantstrat & custom indicators

S
On 5/3/11 3:45 PM, Brian G. Peterson wrote:
Brian - thank you for the thorough detail. This all is very valuable and
I'm going to have to let this sync in my mind to help form my thinking
about the logic and the operation of this package. I do have a couple of
follow-up questions.
I don't believe there is an argument named 'setPosLimit' for the
osMaxPos function. However, there is a function named AddPosLimit - not
sure if you are referring to that one.

Based on the documentation for osMaxPos, it seems the values set in
orderqty= should override that specified in the rule. If I should be
using AddPosLimit instead please let me know.

Here is an example, where longBasket = strategy for long positions, and
portfolio1.st is the portfolio to hold long positions.

Note: the rules have been created with osFun='osMasPos'.

longBasket <- osMaxPos(portfolio=portfolio1.st, ordertype = 'market',
orderqty='65', orderside='long', symbol='IBM')
longBasket <- osMaxPos(portfolio=portfolio1.st, ordertype = 'market',
orderqty='648', orderside='long', symbol='UTX')
shortBasket <- osMaxPos(portfolio=portfolio2.st, ordertype = 'market',
orderqty='-348', orderside='short', symbol='CAT')
shortBasket <- osMaxPos(portfolio=portfolio2.st, ordertype = 'market',
orderqty='-1000', orderside='short', symbol='MSFT')

I unfortunately am missing the timestamp named argument and R throws up
an error exception as a result:
orderqty='65', orderside='long', symbol='IBM')
Error in paste("::", timestamp, sep = "") :
  argument "timestamp" is missing, with no default

Since in my case these maximum position limits should be enforced per
symbol at all times I'm not sure what to specify in the 'timestamp'
argument.