[Candlesticks-commits] r29 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 3 18:05:59 CET 2014


Author: wotuzu17
Date: 2014-01-03 18:05:59 +0100 (Fri, 03 Jan 2014)
New Revision: 29

Modified:
   pkg/DESCRIPTION
   pkg/R/CSPNBlended.R
   pkg/R/CSPNLongCandles.R
   pkg/man/candlesticks-package.Rd
Log:
CSP functions preserve xts dateFormat

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2013-09-15 21:17:43 UTC (rev 28)
+++ pkg/DESCRIPTION	2014-01-03 17:05:59 UTC (rev 29)
@@ -1,8 +1,8 @@
 Package: candlesticks
 Type: Package
 Title: Candlestick Pattern Recognition
-Version: 0.2-3
-Date: 2013-07-24
+Version: 0.2-4
+Date: 2014-01-03
 Author: Andreas Voellenklee
 Maintainer: Andreas Voellenklee <wotuzu17 at gmail.com>
 Depends: R (>= 2.13), xts (>= 0.8-2), quantmod (>= 0.3-17), TTR (>= 0.21-0)

Modified: pkg/R/CSPNBlended.R
===================================================================
--- pkg/R/CSPNBlended.R	2013-09-15 21:17:43 UTC (rev 28)
+++ pkg/R/CSPNBlended.R	2014-01-03 17:05:59 UTC (rev 29)
@@ -9,8 +9,8 @@
   
   LAGTS <- LagOHLC(TS,k=0:(N-1))
   OP <- Op(LAGTS)[,N]
-  HI <- reclass(as.xts(apply(Hi(LAGTS),1,max)), TS)
-  LO <- reclass(as.xts(apply(Lo(LAGTS),1,min)), TS)
+  HI <- reclass(as.xts(apply(Hi(LAGTS),1,max), dateFormat=indexClass(try.xts(TS)[1])), TS)
+  LO <- reclass(as.xts(apply(Lo(LAGTS),1,min), dateFormat=indexClass(try.xts(TS)[1])), TS)
   CL <- Cl(LAGTS)[,1]
   result <- cbind(OP,HI,LO,CL)
   colnames(result) <- c(paste(N, ".Blended.Open", sep=""), 

Modified: pkg/R/CSPNLongCandles.R
===================================================================
--- pkg/R/CSPNLongCandles.R	2013-09-15 21:17:43 UTC (rev 28)
+++ pkg/R/CSPNLongCandles.R	2014-01-03 17:05:59 UTC (rev 29)
@@ -6,7 +6,7 @@
     stop("N has to be a integer >= 1")
   }
   LWC <- CSPLongCandle(TS, n=n, threshold=threshold)[,1] # LongWhiteCandle
-  result <- reclass(as.xts(apply(lag(LWC,k=0:(N-1)),1,all)), TS)
+  result <- reclass(as.xts(apply(lag(LWC,k=0:(N-1)),1,all), dateFormat=indexClass(try.xts(TS)[1])), TS)
   colnames(result) <- paste(N, "LongWhiteCandles", sep="")
   xtsAttributes(result) <- list(bars=N)
   return (result)
@@ -20,7 +20,7 @@
     stop("N has to be a integer >= 1")
   }
   LBC <- CSPLongCandle(TS, n=n, threshold=threshold)[,2] # LongBlackCandle
-  result <- reclass(as.xts(apply(lag(LBC,k=0:(N-1)),1,all)), TS)
+  result <- reclass(as.xts(apply(lag(LBC,k=0:(N-1)),1,all), dateFormat=indexClass(try.xts(TS)[1])), TS)
   colnames(result) <- paste(N, "LongBlackCandles", sep="")
   xtsAttributes(result) <- list(bars=N)
   return (result)
@@ -34,7 +34,7 @@
     stop("N has to be a integer >= 1")
   }
   LWCB <- CSPLongCandleBody(TS, n=n, threshold=threshold)[,1] # LongWhiteCandleBody
-  result <- reclass(as.xts(apply(lag(LWCB,k=0:(N-1)),1,all)), TS)
+  result <- reclass(as.xts(apply(lag(LWCB,k=0:(N-1)),1,all), dateFormat=indexClass(try.xts(TS)[1])), TS)
   colnames(result) <- paste(N, "LongWhiteCandleBodies", sep="")
   xtsAttributes(result) <- list(bars=N)
   return (result)
@@ -48,7 +48,7 @@
     stop("N has to be a integer >= 1")
   }
   LBCB <- CSPLongCandleBody(TS, n=n, threshold=threshold)[,2] # LongBlackCandleBody
-  result <- reclass(as.xts(apply(lag(LBCB,k=0:(N-1)),1,all)), TS)
+  result <- reclass(as.xts(apply(lag(LBCB,k=0:(N-1)),1,all), dateFormat=indexClass(try.xts(TS)[1])), TS)
   colnames(result) <- paste(N, "LongBlackCandleBodies", sep="")
   xtsAttributes(result) <- list(bars=N)
   return (result)

Modified: pkg/man/candlesticks-package.Rd
===================================================================
--- pkg/man/candlesticks-package.Rd	2013-09-15 21:17:43 UTC (rev 28)
+++ pkg/man/candlesticks-package.Rd	2014-01-03 17:05:59 UTC (rev 29)
@@ -31,9 +31,7 @@
 }
 \keyword{ package }
 \note{
-Some functions seem to have problems with timezone settings. It is recommended to set the session's timezone to UTC (command: \code{Sys.setenv(TZ="UTC")} ) in order to prevent issues.
-
-All candlestick pattern detection functions \code{(CSP*)} preserve the xts time series' attributes and add one attribute \code{bars}, that represents the number of bars the formation consits of.
+All candlestick pattern detection functions \code{(CSP*)} preserve the xts time series' attributes and add one attribute \code{bars}, that represents the number of bars the formation consists of.
 }
 \seealso{
 



More information about the Candlesticks-commits mailing list