[R-SIG-Finance] Quantstrat stoplimit orders not triggered

microlino h.stegmann at onlinehome.de
Fri Jul 22 18:49:08 CEST 2011


Thank you, Garrett!

However, unfortunately, it still does not work... The result is not
different from the original version.

As you can see from the orderbook below, a buy order at Close price is
placed whenever the signal is TRUE, i.e. after every bar that closes >1.41.
Simultaneously, a stoplimit order is placed along with every buy order at
the buy price -0.02. So far, so good.

What I expect is that every stoplimit order will be closed later through the
provided example data set, as price falls further. However, only one of the
stoplimit orders is closed, I have highlighted it below. It seems that the
stoplimits are closed only if (price < buyprice - 0.02) AND (signal ==
TRUE). You can easily see this logic in my example if you use a buy
threshold lower than 1.41.

Closing of a simple stoplimit should be triggered by price only, at least
this is what I think it should do. Are stoplimit orders defined differently
in quantstrat, so I need to code another signal that controls the stoplimit
orders separately, somehow? 

Heiko

Index Order.Qty Order.Price Order.Type Order.Side Order.Threshold
Order.Status Order.StatusTime Order.Set Txn.Fees
1999-01-04 00:00:00 0 NA init long 0 closed 1999-01-04 1 0
2010-11-03 17:00:00 -1000 1.3903 stoplimit long -0.02 open NA NA 0
2010-11-03 17:00:00 1000 1.4103 market long NA closed 2010-11-03 21:00:00 NA
0
2010-11-03 21:00:00 -1000 1.3923 stoplimit long -0.02 open NA NA 0
2010-11-03 21:00:00 1000 1.4123 market long NA closed 2010-11-04 01:00:00 NA
0
2010-11-04 01:00:00 -1000 1.3923 stoplimit long -0.02 open NA NA 0
2010-11-04 01:00:00 1000 1.4123 market long NA closed 2010-11-04 05:00:00 NA
0
2010-11-04 05:00:00 -1000 1.3935 stoplimit long -0.02 open NA NA 0
2010-11-04 05:00:00 1000 1.4135 market long NA closed 2010-11-04 09:00:00 NA
0
2010-11-04 09:00:00 -1000 1.4025 stoplimit long -0.02 open NA NA 0
2010-11-04 09:00:00 1000 1.4225 market long NA closed 2010-11-04 13:00:00 NA
0
*2010-11-04 13:00:00 -1000 1.4052 stoplimit long -0.02 closed 2010-11-05
13:00:00 NA 0*
2010-11-04 13:00:00 1000 1.4252 market long NA closed 2010-11-04 17:00:00 NA
0
2010-11-04 17:00:00 -1000 1.4008 stoplimit long -0.02 open NA NA 0
2010-11-04 17:00:00 1000 1.4208 market long NA closed 2010-11-04 21:00:00 NA
0
2010-11-04 21:00:00 -1000 1.4012 stoplimit long -0.02 open NA NA 0
2010-11-04 21:00:00 1000 1.4212 market long NA closed 2010-11-05 01:00:00 NA
0
2010-11-05 01:00:00 -1000 1.4009 stoplimit long -0.02 open NA NA 0
2010-11-05 01:00:00 1000 1.4209 market long NA closed 2010-11-05 05:00:00 NA
0
2010-11-05 05:00:00 -1000 1.3985 stoplimit long -0.02 open NA NA 0
2010-11-05 05:00:00 1000 1.4185 market long NA closed 2010-11-05 09:00:00 NA
0
2010-11-05 09:00:00 -1000 1.3901 stoplimit long -0.02 open NA NA 0
2010-11-05 09:00:00 1000 1.4101 market long NA closed 2010-11-05 13:00:00 NA
0

--
View this message in context: http://r.789695.n4.nabble.com/Quantstrat-stoplimit-orders-not-triggered-tp3673706p3687209.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list