Skip to content

Instantly share code, notes, and snippets.

@javagg
Created July 4, 2012 11:23
Show Gist options
  • Save javagg/3046849 to your computer and use it in GitHub Desktop.
Save javagg/3046849 to your computer and use it in GitHub Desktop.
quantstrat signal generation
x1 <- seq(from=1, to=10, by=0.5)
x2 <- seq(from=13, to=4, by=-0.5)
x <- xts(matrix(c(x1=x1, x2=x2), ncol=2), order.by=Sys.time()+1:length(x1))
colnames(x) <- c("x1", "x2")
x$comparison <- sigComparison(label="", data=x, columns=c("x1", "x2"), relationship="gt")
x$crossover <- sigCrossover(label="", data=x, columns=c("x1", "x2"), relationship="gt")
x$threshold1 <- sigThreshold(label="", data=x, column="x1", threshold=2.3, relationship="gt", cross=T)
x$threshold2 <- sigThreshold(label="", data=x, column="x1", threshold=2.3, relationship="gt", cross=F)
x
x1 <- seq(from=1, to=10, by=0.5)
x2 <- seq(from=13, to=4, by=-0.5)
x <- xts(matrix(c(x1=x1, x2=x2), ncol=2), order.by=Sys.time()+1:length(x1))
colnames(x) <- c("x1", "x2")
x$comparison <- sigComparison(label="", data=x, columns=c("x1", "x2"), relationship="gt")
x$crossover <- sigCrossover(label="", data=x, columns=c("x1", "x2"), relationship="gt")
x$threshold <- sigThreshold(label="", data=x, column="x1", threshold=2.3, relationship="gt", cross=T)
x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment