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

Michael Chen mwc4120 at hotmail.com
Wed Dec 28 05:09:38 CET 2016


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.

________________________________
From: Brian G. Peterson <brian at braverock.com>
Sent: Tuesday, December 27, 2016 2:35 PM
To: Michael Chen; r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] Clarification on trailing stop.

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/
Brian G. Peterson<http://braverock.com/brian/>
braverock.com
BRIAN G. PETERSON 773-459-4973. brian at braverock.com. download resume as PDF SUMMARY. Senior quantitative trader, financial analyst, technical architect, and project ...


Ph: 773-459-4973
IM: bgpbraverock

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list