[R-SIG-Finance] Clarification on trailing stop.

Brian G. Peterson brian at braverock.com
Tue Dec 27 23:35:17 CET 2016


On Tue, 2016-12-27 at 08:07 +0000, Michael Chen wrote:
> I am little confused regarding the "prefer" setting in trailing stop
> orders (may also apply to normal orders).  Setting prefer =
> "High",  as presented in the Luxor example, means to me that the
> trailing stop is set at the preset threshold level less than the most
> recent high.  Default prefer is set for 'Close'.   Prefer= sets the
> price column to use from data object (mktdata),  but I also read from
> well-informed bloggers that setting prefer = 'Open' means that after
> the condition is satisfied, the execution of the order will be at the
> Open of next bar instead of the Close.  So, is "Prefer=" setting
> defines the data column to be used in the apply rule calculations or
> is it used for preference for the point of execution for the
> order?  or both?
> 
> thanks again and I apologize if this has been answered before.  my
> search didn't reveal anything.


The prefer= argument is passed to the getPrice() fn, and will determine
the price column that is used to set your threshold.

stoplimit orders will execute at the limit, so it should be 'High' +/-
threshold (depending on whether you are buying or selling)

Regards,

Brian

-- 
Brian G. Peterson 
http://braverock.com/brian/ 
Ph: 773-459-4973 
IM: bgpbraverock



More information about the R-SIG-Finance mailing list