[Candlesticks-commits] r33 - in pkg: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 1 21:09:01 CEST 2018


Author: wotuzu17
Date: 2018-09-01 21:09:01 +0200 (Sat, 01 Sep 2018)
New Revision: 33

Modified:
   pkg/CHANGES
   pkg/DESCRIPTION
   pkg/R/CSPNLongCandles.R
   pkg/R/CSPThreeMethods.R
   pkg/R/DonchianChannel2.R
   pkg/R/LagFunctions.R
Log:
lag -> stats::lag

Modified: pkg/CHANGES
===================================================================
--- pkg/CHANGES	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/CHANGES	2018-09-01 19:09:01 UTC (rev 33)
@@ -1,3 +1,3 @@
 0.1-1 va            initial version
 0.2-5 va 2015-05-25 svn update to trigger build process on R-forge
-
+0.2-6 va 2018-09-01 lag -> stats::lag to prevent issues with dplyr

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/DESCRIPTION	2018-09-01 19:09:01 UTC (rev 33)
@@ -1,8 +1,8 @@
 Package: candlesticks
 Type: Package
 Title: Candlestick Pattern Recognition
-Version: 0.2-5
-Date: 2014-04-21
+Version: 0.2-6
+Date: 2018-09-01
 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/CSPNLongCandles.R
===================================================================
--- pkg/R/CSPNLongCandles.R	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/R/CSPNLongCandles.R	2018-09-01 19:09:01 UTC (rev 33)
@@ -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), dateFormat=indexClass(try.xts(TS)[1])), TS)
+  result <- reclass(as.xts(apply(stats::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), dateFormat=indexClass(try.xts(TS)[1])), TS)
+  result <- reclass(as.xts(apply(stats::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), dateFormat=indexClass(try.xts(TS)[1])), TS)
+  result <- reclass(as.xts(apply(stats::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), dateFormat=indexClass(try.xts(TS)[1])), TS)
+  result <- reclass(as.xts(apply(stats::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/R/CSPThreeMethods.R
===================================================================
--- pkg/R/CSPThreeMethods.R	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/R/CSPThreeMethods.R	2018-09-01 19:09:01 UTC (rev 33)
@@ -5,10 +5,10 @@
   LAG4TS <- LagOHLC(TS, k=4)
   LAG3TS <- LagOC(TS, k=3)
   LAG1TS <- LagOC(TS, k=1)
-  MAXOP <- lag(runMax(Op(TS), n=3), k=1) # max open for middle 3 candles
-  MAXCL <- lag(runMax(Cl(TS), n=3), k=1) # max close for middle 3 candles 
-  MINOP <- lag(runMin(Op(TS), n=3), k=1) # min open for middle 3 candles
-  MINCL <- lag(runMin(Cl(TS), n=3), k=1) # min close for middle 3 candles
+  MAXOP <- stats::lag(runMax(Op(TS), n=3), k=1) # max open for middle 3 candles
+  MAXCL <- stats::ag(runMax(Cl(TS), n=3), k=1) # max close for middle 3 candles
+  MINOP <- stats::lag(runMin(Op(TS), n=3), k=1) # min open for middle 3 candles
+  MINCL <- stats::lag(runMin(Cl(TS), n=3), k=1) # min close for middle 3 candles
   LC4 <- CSPLongCandleBody(LAG4TS, n=n, threshold=threshold)
   LC0 <- CSPLongCandleBody(TS, n=n, threshold=threshold)
   RTM <- reclass(
@@ -35,4 +35,4 @@
   colnames (result) <- c("RisingThreeMethods", "FallingThreeMethods")
   xtsAttributes(result) <- list(bars=5)
   return (result)
-}
\ No newline at end of file
+}

Modified: pkg/R/DonchianChannel2.R
===================================================================
--- pkg/R/DonchianChannel2.R	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/R/DonchianChannel2.R	2018-09-01 19:09:01 UTC (rev 33)
@@ -11,7 +11,7 @@
     high <- runMax(hi, n)
     low <- runMin(lo, n)
     mid <- (high + low)/2
-    result <- lag(cbind(high, mid, low))
+    result <- stats::lag(cbind(high, mid, low))
     colnames(result) <- c("high", "mid", "low")
     return(result)
-  }
\ No newline at end of file
+  }

Modified: pkg/R/LagFunctions.R
===================================================================
--- pkg/R/LagFunctions.R	2015-12-28 13:42:50 UTC (rev 32)
+++ pkg/R/LagFunctions.R	2018-09-01 19:09:01 UTC (rev 33)
@@ -1,7 +1,7 @@
 # Function is.OC and is.HL are not included in quantmod
 is.OC <- function (x)
 {
-  if (has.Op(x) & has.Cl(x)) { 
+  if (has.Op(x) & has.Cl(x)) {
      TRUE
   }
   else FALSE
@@ -9,7 +9,7 @@
 
 is.HL <- function (x)
 {
-  if (has.Hi(x) & has.Lo(x)) { 
+  if (has.Hi(x) & has.Lo(x)) {
      TRUE
   }
   else FALSE
@@ -19,7 +19,7 @@
   if (!is.OHLC(TS)) {
     stop("Price series must contain Open, High, Low and Close.")
   }
-  result <- cbind(lag(Op(TS),k), lag(Hi(TS),k), lag(Lo(TS),k), lag(Cl(TS),k))
+  result <- cbind(stats::lag(Op(TS),k), stats::lag(Hi(TS),k), stats::lag(Lo(TS),k), stats::lag(Cl(TS),k))
   colnames(result) <- c(
     paste(colnames(Op(TS)),k,sep='.Lag.'),
     paste(colnames(Hi(TS)),k,sep='.Lag.'),
@@ -32,7 +32,7 @@
   if (!is.OC(TS)) {
     stop("Price series must contain Open and Close.")
   }
-  result <- cbind(lag(Op(TS),k), lag(Cl(TS),k))
+  result <- cbind(stats::lag(Op(TS),k), stats::lag(Cl(TS),k))
   colnames(result) <- c(
     paste(colnames(Op(TS)),k,sep='.Lag.'),
     paste(colnames(Cl(TS)),k,sep='.Lag.'))



More information about the Candlesticks-commits mailing list