[R-SIG-Finance] Exit Timing in Quantstrat

Brian G. Peterson brian at braverock.com
Thu Jan 7 14:52:35 CET 2016


use lag() as your signal function.

e.g.

x<-xts(sample(c(rep(0,5),1),100,replace=TRUE),as.Date(1:100))
cbind(x,lag(x,-5))

the second column demonstrates your signal column.

Regards,

Brian

On Thu, 2016-01-07 at 22:45 +0900, Damon Verial wrote:
> Let's say I want to exit a certain number of days after I see a certain
> candlestick pattern. How would I do this in quantstrat? I have the
> candlestick pattern programming down, but I don't know how to make the exit
> rule align with the candlestick pattern.
> 
> Assume I have an indicator called "candlestick." How would I assign the
> signal and rule to exit X days after seeing the indicator?
> 
> Damon Verial
> Office: (206) 395-3688
> Skype: DamonVerial
> YouTube Channel <https://www.youtube.com/channel/UChoZqpn_fLmoExx2g4KL58A>
> Is Altria Group a Quality Investment?
> <http://seekingalpha.com/article/3788476-is-altria-group-a-quality-investment>
> I purposely keep my emails to 5 sentences or fewer - which is a miracle for
> a writer.
> I do this to show that I respect both your time and mine.
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> 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.

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



More information about the R-SIG-Finance mailing list