Skip to content
Prev 12899 / 15274 Next

quantstrat help

Thx Josh.

Here is the code:

require(quantmod)
require(TTR)
getSymbols('^GSPC')
colnames(GSPC)=c("Open","High","Low","Close","Volume","AdjPrice")
for (i in 1: nrow(GSPC))
{
  GSPC$signal[i]=ifelse((GSPC$Close[i]>1.02*GSPC$Open[i]), 1
,ifelse(GSPC$Close[i]<= 0.98*GSPC$Open[i], -1, 0))
}

So there will be consecutive days of longs or shorts but how to ignore
the subsequent signals and take the first occurrences inside
quantstrat pls?

Rgds
Raghu
On Fri, Oct 17, 2014 at 12:50 PM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote: