On 02/10/2018 12:14 AM, Sanjay Mansabdar via R-SIG-Finance wrote:
I have been trying to model stoplosses in quantstrat. Since intra day lows can
be spurious whipsaws, I would like to model a stop loss that triggers a market
order at the open of the next day if the stop was triggered based on the close
of the previous day. As of now it appears that using stoplimit orders triggers
the market order based on the high( for short open positions) or the low( for
long open positions). I’ve tried playing around with the prefer = option but I
haven’t been able to see any changes based on this setting.
Any help on how I can model these stop orders would be appreciated.
Many thanks to Ilya Kipnis for pointing me to this group. Also many thanks in
advance.
Sanjay,
There are two basic approaches to what you want to do:
- construct a signal to fire for the case that you are describing
There should be nothing stopping you from firing a signal based on the
close price and using a regular market order to enter on the Open of the
next bar.
Your rule (presumably calling ruleSignal) should use prefer='Open'
Stops on bars are inherently a guess. So we've chosen to have the stop
entry enter on the least favorable price. This is documented, and
shouldn't be surprising behavior.
- use higher frequency data
If you really must use stops for this, then use higher frequency data.
If this still produces what you feel to be surprising behavior, then
please produce a *minimal* reproducible example and enter an issue on
the quantstrat github.
Regards,
Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should
go.