[R-SIG-Finance] Clarification on trailing stop.
Brian G. Peterson
brian at braverock.com
Wed Dec 28 11:11:24 CET 2016
On 12/27/2016 10:09 PM, Michael Chen wrote:
> Thanks Brian, as always. Just to make sure, for all order types,
> "prefer=", sets the column data for calculation and therefore for
> excution. So, stoplimit/trailing stop orders are excute at that
> limit ('prefer=high' ± threshold), but market orders are executed at
> the next bar (if my indicator uses Cl for normal entry), then useing
> "prefer=open" will get the transaction price at open of the next
> bar.
It would be prefer="open", but yes.
Also be aware that this is a bit sloppy. Real markets don't trade in bars.
Most investors don't really have access to the opening or closing
auctions if building backtests on daily data. As noted in the
documentation and I have noted elsewhere, intraday historical data is
readily available, so in most cases you would likely be better served
using intraday data and something like a VWAP price if you have the data
available.
in any case, the prefer= argument is a pass-through to getPrice.
quantstrat will make reasonable guesses based on your data if it is not
set. see
?getPrice
for more information on how getPrice works to extract price data.
Regards,
Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list