(z <- Sys.time())
## [1] "2014-12-29 11:42:26 JST"
attach(lll)
library(dtw)
## Loading required package: proxy
##
## Attaching package: 'proxy'
##
## The following objects are masked from 'package:stats':
##
## as.dist, dist
##
## Loaded dtw v1.17-1. See ?dtw for help, citation("dtw") for use in publication.
library(dplyr)
##
## Attaching package: 'dplyr'
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
par(mfrow = c(3,2))
srch <- 220502
srch2 <- srch + 288
trade <- srch + 96
plot(Close[srch:srch2], xlab=Time[srch], ylab="Original", type="l", lwd=2)
abline(h=Close[trade], col="gray")
plot(RSI[srch:srch2], xlab=Time[srch], ylab="Original", xlim=c(0,300), ylim=c(0,100), type="l", lwd=2, col="lightgreen")
i <- 0
while(i <= 260000){
i <- i + 1
n <- i + 96
H4 <- i + 288
if(dtw(RSI[i:n], RSI[220502:220598], step=asymmetric, open.end=TRUE, open.begin=TRUE)$distance < 300){
plot(Close[srch:srch2], axes=F, xlab="", ylab="", type="l", lwd=2)
par(new=T)
plot(Close[i:H4], xlab=Time[i], ylab=X[i], type="l")
abline(h=Close[i + 96], col="blue")
if(Close[i + 96] < (max(Close[n:H4]) + min(Close[n:H4]))/2){
abline(h=Close[i + 96], col="red")
}
plot(RSI[i:H4], xlab=Time[i], ylab=X[i], xlim=c(0,300), ylim=c(0,100), type="l")
par(new=T)
plot(RSI[220502:220790], xlab=Time[i], ylab=X[i], xlim=c(0,300), ylim=c(0,100), type="l", col="lightgreen")
i <- i + 96
}
}















































(z <- Sys.time())
## [1] "2014-12-29 12:06:34 JST"
