Brian,
I can't get that to work. It used to be that exit orders would fire
before enter orders and if you did not have a position, they were
effectively not sent.
I tried to test this by making a tiny change to the maCross.R demo. I
changed the second add.signal call so that it had
relationship="gte"
just like the first add.signal call. In other words, you should get
an enter and exit at the same time. So, you should never have a
position. Nevertheless, you end up with a position of short 600
shares. If that's not right, then I doubt that adding prefer="Open"
to one and prefer="Close" to the other will work.
Garrett
On Sun, May 13, 2012 at 3:20 PM, Brian G. Peterson <brian at braverock.com> wrote:
On Sun, 2012-05-13 at 15:55 -0400, s p wrote:
okay so that means I can't use quantstrat for strategies where the
entry and exit are on the same bar (in this case daily bar).
Sure you can, if the signal is on the same observation.
I'm not sure how realistic a backtest of market on open and market on
close is going to be, of course, because of slippage, but it should
'work' in quantstrat.
Your entry rule would use prefer='Open' and your exit rule would use
prefer='Close'.
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock