Skip to content
Prev 13866 / 15274 Next

Long Enter Position do not "block" Short Enter Orders

Thank you Ilya,

I've placed orderset='ocoall' in both ENTER orders (named "LE" and "SE") 
as in the following code but testing them I have the same problem: long 
positions are closed by short (enter) positions...
Can you please tell me what I'm doing wrong?

Diego


#################################
# MAX POSITION (1 future)
#################################
addPosLimit(portfolio = qs.strategy, symbol = symbol, timestamp = 
initDate, maxpos = 1)

#################################
# LONG STRATEGY
#################################
add.rule(qs.strategy, name='ruleSignal',
          arguments = list(sigcol="upTrend", sigval=TRUE,
                           replace=TRUE,
                           prefer='Open',
                           orderside='long',
                           ordertype='stoplimit',
order.price=quote(mktdata$price.enter.long[timestamp]),
                           orderqty=1,
                           osFUN='osMaxPos',
                           orderset='ocoall',
                           time.in.force=quote(timeInForceLong)),
          type='enter',
          label='LE')

add.rule(qs.strategy, name='ruleSignal',
          arguments=list(sigcol='exitLong', sigval=TRUE,
                         replace=FALSE,
                         orderside='long',
                         ordertype='market',
                         orderqty='all',
                         prefer='Open'
          ),
          type='exit',
          label='ExitLong',
          enabled=TRUE)

#################################
# SHORT STRATEGY
#################################
add.rule(qs.strategy, name='ruleSignal',
          arguments=list(sigcol="downTrend", sigval=TRUE,
                         replace=TRUE,
                         prefer='Open',
                         orderside='short',
                         ordertype='stoplimit',
order.price=quote(mktdata$price.enter.short[timestamp]),
                         orderqty=-1,
                         osFUN='osMaxPos',
                         orderset='ocoall',
                         time.in.force=quote(timeInForceShort)),
          type='enter',
          label='SE')

add.rule(qs.strategy, name='ruleSignal',
          arguments=list(sigcol='exitShort', sigval=TRUE,
                         replace=FALSE,
                         orderside='short',
                         ordertype='market',
                         orderqty='all',
                         prefer='Open'
          ),
          type='exit',
          label='ExitShort',
          enabled=TRUE)
On 11/04/2016 15:05, Ilya Kipnis wrote:

  
  

Thread (25 messages)

Jersey Fanatic Processing time of backtests on a single computer Apr 6 Brian G. Peterson Processing time of backtests on a single computer Apr 6 Jersey Fanatic Processing time of backtests on a single computer Apr 6 Brian G. Peterson Processing time of backtests on a single computer Apr 6 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Joshua Ulrich Processing time of backtests on a single computer Apr 7 david.jessop at ubs.com Processing time of backtests on a single computer Apr 7 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Joshua Ulrich Processing time of backtests on a single computer Apr 7 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Erol Biceroglu Processing time of backtests on a single computer Apr 7 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Jersey Fanatic Processing time of backtests on a single computer Apr 7 Frank Processing time of backtests on a singlecomputer Apr 8 Jersey Fanatic Processing time of backtests on a singlecomputer Apr 8 Frank Processing time of backtests on a singlecomputer Apr 8 Jersey Fanatic Processing time of backtests on a singlecomputer Apr 9 Brian G. Peterson Processing time of backtests on a single computer Apr 9 Diego Peroni Long Enter Position do not "block" Short Enter Orders Apr 11 Ilya Kipnis Long Enter Position do not "block" Short Enter Orders Apr 11 Diego Peroni Long Enter Position do not "block" Short Enter Orders Apr 11 Ilya Kipnis Long Enter Position do not "block" Short Enter Orders Apr 11 Diego Peroni Long Enter Position do not "block" Short Enter Orders Apr 11 Ilya Kipnis Long Enter Position do not "block" Short Enter Orders Apr 11