quanstrat rule to exit same day close (using daily data)
In quantstrat, if your have a signal on bar t, the rule will be executed at bar t+1. In your case, this means that the order will be added for the next day. Use the 'prefer'-argument to specify which of next day's rates (open, low, high, close) you want to use.
On 12-05-12 23:45, algotr8der wrote:
I am trying to backtest a strategy that requires an exit on the close (same day as the entry). I have searched through Rmetrics and stackoverflow and found the following post: http://stackoverflow.com/questions/10441614/quantstrat-in-r-setting-a-date-based-exit-signal Brian Peterson said the following:
quantstrat, as described in the manual, is a signals-based framework. It is
not designed for filters based trades really.
You could do what you want by using the delay argument to your exit rule.
Set the delay to be one day, and the prefer argument to prefer a different price column.
I'm not going to write it for you, but that is enough information to solve
your problem. Now this was a solution to exit at a future time stamp. I want to exit the *same* day (I am using daily data for my test) which is why I'm not sure if setting a delay really works for what I want to do. Is this at all possible? Appreciate the direction. -- View this message in context: http://r.789695.n4.nabble.com/quanstrat-rule-to-exit-same-day-close-using-daily-data-tp4629612.html Sent from the Rmetrics mailing list archive at Nabble.com.
_______________________________________________ R-SIG-Finance at 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.
Jan Humme - OpenTrades WWW: http://www.opentrades.nl Email: jan at opentrades dot nl Twitter: @opentrades