[R-SIG-Finance] Writing sell rules with quantstrat

Brian G. Peterson brian at braverock.com
Fri Feb 17 13:57:29 CET 2012

On Wed, 2012-02-15 at 20:16 -0800, Sergey Pisarenko wrote:
> I think this has to do with the fact that stop-limit order triggers
> whenever the price is below the threshold. In other words, if I buy
> shares for 30 and set a stop-limit order at 50 the stop-limit order
> will trigger next day because the price is already below 50. It seems
> that the stop-limit in its current implementation is not designed for
> the case of gains. Instead, it works only for losses. When I set
> threshold to say 0.9 (10% loss) I see that it behaves as expected and
> the order is executed only when the price goes down 10%.

I should have seen this yesterday...  A regular 'limit' order can be
used for gains, as your resting order will be on the 'correct' side of
the market for a resting limit.  A 'stoplimit' order may be used when
your order is on the 'wrong' side of the market, and could not rest in
the order book as a normal limit order.


   - Brian
Brian G. Peterson
Ph: 773-459-4973
IM: bgpbraverock

More information about the R-SIG-Finance mailing list