[Candlesticks-commits] r17 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 22 14:13:25 CEST 2012


Author: wotuzu17
Date: 2012-04-22 14:13:24 +0200 (Sun, 22 Apr 2012)
New Revision: 17

Modified:
   pkg/R/CSPDarkCloudCover.R
   pkg/R/CSPDoji.R
   pkg/R/CSPEngulfing.R
   pkg/R/CSPGap.R
   pkg/R/CSPHammer.R
   pkg/R/CSPHangingMan.R
   pkg/R/CSPHarami.R
   pkg/R/CSPInsideDay.R
   pkg/R/CSPKicking.R
   pkg/R/CSPLongCandle.R
   pkg/R/CSPMarubozu.R
   pkg/R/CSPNHigherClose.R
   pkg/R/CSPPiercingPattern.R
   pkg/R/CSPStar.R
   pkg/R/CSPStomache.R
   pkg/R/CSPTasukiGap.R
   pkg/R/CSPThreeInside.R
   pkg/R/CSPThreeMethods.R
   pkg/R/CSPThreeOutside.R
   pkg/R/CSPThreeWhiteSoldiers.R
   pkg/R/TrendDetectionChannel.R
   pkg/R/TrendDetectionSMA.R
   pkg/man/CSPDarkCloudCover.Rd
   pkg/man/CSPDoji.Rd
   pkg/man/CSPEngulfing.Rd
   pkg/man/CSPHammer.Rd
   pkg/man/CSPHangingMan.Rd
   pkg/man/CSPHarami.Rd
   pkg/man/CSPPiercingPattern.Rd
   pkg/man/CSPStar.Rd
   pkg/man/CSPStomache.Rd
   pkg/man/CSPTasukiGap.Rd
   pkg/man/CSPThreeBlackCrows.Rd
   pkg/man/CSPThreeInside.Rd
   pkg/man/CSPThreeMethods.Rd
   pkg/man/CSPThreeOutside.Rd
   pkg/man/CSPThreeWhiteSoldiers.Rd
   pkg/man/LagOHLC.Rd
   pkg/man/TrendDetectionChannel.Rd
   pkg/man/TrendDetectionSMA.Rd
Log:
removed eval commands

Modified: pkg/R/CSPDarkCloudCover.R
===================================================================
--- pkg/R/CSPDarkCloudCover.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPDarkCloudCover.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,11 +4,11 @@
   }
   LAGTS <- LagOC(TS, k=1)
   LongCandleBody <- CSPLongCandleBody(LAGTS, n=n, threshold=minbodysizeMedian)
-  DarkCloudCover <- reclass(eval (
+  DarkCloudCover <- reclass(
     LongCandleBody[,"LongWhiteCandleBody"] & # first candle is white and longer than median of past n candles
     Op(TS)>Cl(LAGTS) &                 # second candle opens higher than close of 1st candle
     (Op(LAGTS)+Cl(LAGTS))/2 >= Cl(TS) &# second candle closes at or below half of 1st candles' body 
-    Cl(TS)>Op(LAGTS) ), TS)            # close of second candle is higher than open of 1st candle
+    Cl(TS)>Op(LAGTS), TS)            # close of second candle is higher than open of 1st candle
   colnames(DarkCloudCover) <- c("DarkCloudCover")
   xtsAttributes(DarkCloudCover) <- list(bars=2)
   return(DarkCloudCover)

Modified: pkg/R/CSPDoji.R
===================================================================
--- pkg/R/CSPDoji.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPDoji.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -6,9 +6,9 @@
   CL <- Hi(TS)-Lo(TS)
   BodyHi <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,max))
   BodyLo <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,min))
-  Doji <- reclass(eval (BL < CL* maxbodyCL), TS)
-  DFDoji <- reclass(eval (Doji & (Hi(TS)-BodyHi <= CL* maxshadowCL)), TS)
-  GSDoji <- reclass(eval (Doji & (BodyLo-Lo(TS) <= CL* maxshadowCL)), TS)
+  Doji <- reclass(BL < CL* maxbodyCL, TS)
+  DFDoji <- reclass(Doji & (Hi(TS)-BodyHi <= CL* maxshadowCL), TS)
+  GSDoji <- reclass(Doji & (BodyLo-Lo(TS) <= CL* maxshadowCL), TS)
   result <- cbind(Doji, DFDoji, GSDoji)
   colnames(result) <- c("Doji", "DragonflyDoji", "GravestoneDoji")
   xtsAttributes(result) <- list(bars=1)

Modified: pkg/R/CSPEngulfing.R
===================================================================
--- pkg/R/CSPEngulfing.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPEngulfing.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -3,8 +3,8 @@
     stop("Price series must contain Open and Close.")
   }
   LAGTS <- LagOC(TS, k=1)
-  BullEngulfing <- reclass(eval( Op(LAGTS)>Cl(LAGTS) & Cl(TS)>Op(TS) & Cl(LAGTS)>=Op(TS) & Cl(TS)>=Op(LAGTS) ), TS)
-  BearEngulfing <- reclass(eval( Cl(LAGTS)>Op(LAGTS) & Op(TS)>Cl(TS) & Op(LAGTS)>=Cl(TS) & Op(TS)>=Cl(LAGTS) ), TS)
+  BullEngulfing <- reclass( Op(LAGTS)>Cl(LAGTS) & Cl(TS)>Op(TS) & Cl(LAGTS)>=Op(TS) & Cl(TS)>=Op(LAGTS) , TS)
+  BearEngulfing <- reclass( Cl(LAGTS)>Op(LAGTS) & Op(TS)>Cl(TS) & Op(LAGTS)>=Cl(TS) & Op(TS)>=Cl(LAGTS) , TS)
   result <- cbind(BullEngulfing, BearEngulfing)
   colnames(result) <- c("Bull.Engulfing", "Bear.Engulfing")
   xtsAttributes(result) <- list(bars=2)

Modified: pkg/R/CSPGap.R
===================================================================
--- pkg/R/CSPGap.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPGap.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -6,16 +6,16 @@
     LAGTS <- LagOC(TS, k=1)
     TSOC <- cbind(Op(TS), Cl(TS))
     LAGTSOC <- cbind(Op(LAGTS), Cl(LAGTS))
-    UPGAP <- reclass(eval(as.xts(apply(LAGTSOC,1,max)) < as.xts(apply(TSOC,1,min))), TS)
-    DOWNGAP <- reclass(eval(as.xts(apply(LAGTSOC,1,min)) > as.xts(apply(TSOC,1,max))), TS)
+    UPGAP <- reclass( as.xts(apply(LAGTSOC,1,max)) < as.xts(apply(TSOC,1,min)) , TS)
+    DOWNGAP <- reclass( as.xts(apply(LAGTSOC,1,min)) > as.xts(apply(TSOC,1,max)), TS)
   }
   else if (ignoreShadows==FALSE) {
     if (!is.OHLC(TS)) {
       stop("Price series must contain Open, High, Low and Close.")
     }
     LAGTS <- LagOHLC(TS, k=1)
-    UPGAP <- reclass(eval(Lo(TS) > Hi(LAGTS)), TS)
-    DOWNGAP <- reclass(eval(Hi(TS) < Lo(LAGTS)), TS)
+    UPGAP <- reclass( Lo(TS) > Hi(LAGTS) , TS)
+    DOWNGAP <- reclass( Hi(TS) < Lo(LAGTS) , TS)
   }
   result <- cbind(UPGAP, DOWNGAP)
   colnames(result) <- c("GapUp", "GapDown")

Modified: pkg/R/CSPHammer.R
===================================================================
--- pkg/R/CSPHammer.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPHammer.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -5,10 +5,10 @@
   CL <- Hi(TS)-Lo(TS)
   BodyHi <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,max))
   BodyLo <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,min))
-  Hammer <- reclass( eval (
-    BodyLo-Lo(TS) > CL*minlowershadowCL &   # lower shadow greater than lowershadeCL*CandleLength
+  Hammer <- reclass(
+    BodyLo-Lo(TS) > CL*minlowershadowCL &   # lower shadow greater than lowershadowCL*CandleLength
     Hi(TS)- BodyHi <= CL*maxuppershadowCL & # upper shadow missing or very short
-    abs (Cl(TS)-Op(TS)) > CL*minbodyCL)     # Body length greater than minbodyCL*CandleLength
+    abs (Cl(TS)-Op(TS)) > CL*minbodyCL      # Body length greater than minbodyCL*CandleLength
     ,TS)
   colnames(Hammer) <- c("Hammer")
   xtsAttributes(Hammer) <- list(bars=1)

Modified: pkg/R/CSPHangingMan.R
===================================================================
--- pkg/R/CSPHangingMan.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPHangingMan.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -5,10 +5,10 @@
   CL <- Hi(TS)-Lo(TS)
   BodyHi <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,max))
   BodyLo <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,min))
-  HangingMan <- reclass( eval (
-    Hi(TS)- BodyHi > CL*minuppershadowCL &   # upper shadow greater than lowershadeCL*CandleLength
+  HangingMan <- reclass(
+    Hi(TS)- BodyHi > CL*minuppershadowCL &   # upper shadow greater than lowershadowCL*CandleLength
     BodyLo- Lo(TS) <= CL*maxlowershadowCL &  # lower shadow missing or very short
-    abs (Cl(TS)-Op(TS)) > CL*minbodyCL)      # Body length greater than minbodyCL*CandleLength
+    abs (Cl(TS)-Op(TS)) > CL*minbodyCL       # Body length greater than minbodyCL*CandleLength
     ,TS)
   colnames(HangingMan) <- c("HangingMan")
   xtsAttributes(HangingMan) <- list(bars=1)

Modified: pkg/R/CSPHarami.R
===================================================================
--- pkg/R/CSPHarami.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPHarami.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,16 +4,16 @@
   }
   LAGTS <- LagOC(TS, k=1)
   LongCandleBody <- CSPLongCandleBody(LAGTS, n=n, threshold=minbodysizeMedian)
-  BullHarami <- reclass(eval(
+  BullHarami <- reclass(
     LongCandleBody[,2] &                     # body of mother candle is black and longer than average
     Cl(TS)>Op(TS) &                          # second candle is white
     Op(LAGTS)>Cl(TS) & Cl(LAGTS)<Op(TS)      # second body is within first body
-    ), TS)
-  BearHarami <- reclass(eval(
+    , TS)
+  BearHarami <- reclass(
     LongCandleBody[,1] &                     # body of mother candle is white and longer than average
     Cl(TS)<Op(TS) &                          # second candle is white
     Op(LAGTS)<Cl(TS) & Cl(LAGTS)>Op(TS)      # second body is within first body
-    ), TS)
+    , TS)
   result <- cbind(BullHarami, BearHarami)
   colnames(result) <- c("Bull.Harami", "Bear.Harami")
   xtsAttributes(result) <- list(bars=2)

Modified: pkg/R/CSPInsideDay.R
===================================================================
--- pkg/R/CSPInsideDay.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPInsideDay.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -3,7 +3,7 @@
     stop("Price series must contain Open, High, Low and Close.")
   }
   LAGTS <- LagOHLC(TS, k=1)
-  result <- reclass(eval(Hi(TS)<=Hi(LAGTS) & Lo(TS)>=Lo(LAGTS)), TS)
+  result <- reclass( Hi(TS)<=Hi(LAGTS) & Lo(TS)>=Lo(LAGTS) , TS)
   colnames(result) <- "InsideDay"
   xtsAttributes(result) <- list(bars=2)
   return (result)
@@ -14,7 +14,7 @@
     stop("Price series must contain Open, High, Low and Close.")
   }
   LAGTS <- LagOHLC(TS, k=1)
-  result <- reclass(eval(Hi(TS)>Hi(LAGTS) & Lo(TS)<Lo(LAGTS)), TS)
+  result <- reclass( Hi(TS)>Hi(LAGTS) & Lo(TS)<Lo(LAGTS) , TS)
   colnames(result) <- "OutsideDay"
   xtsAttributes(result) <- list(bars=2)
   return (result)

Modified: pkg/R/CSPKicking.R
===================================================================
--- pkg/R/CSPKicking.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPKicking.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -8,25 +8,25 @@
     WMB1 <- Lag(MB[,1], k=1)
     BMB1 <- Lag(MB[,4], k=1)
     BULLK <- reclass( 
-      eval(TSGAP[,1] &         # Gap Up
-      BMB1 & MB[,1]),          # 1st candle is black marubozu, 2nd candle is white marubozu
-      TS)
+      TSGAP[,1] &              # Gap Up
+      BMB1 & MB[,1]            # 1st candle is black marubozu, 2nd candle is white marubozu
+      , TS)
     BEARK <- reclass(
-      eval(TSGAP[,2] &         # Gap Down
-      WMB1 & MB[,4]),          # 1st candle is white marubozu, 2nd candle is black marubozu
-      TS)
+      TSGAP[,2] &              # Gap Down
+      WMB1 & MB[,4]            # 1st candle is white marubozu, 2nd candle is black marubozu
+      , TS)
   } else if (ignoreShadows==TRUE) {
     LCB <- CSPLongCandleBody(TS, n=n, threshold=threshold)
     LWCB1 <- Lag(LCB[,1], k=1)
     LBCB1 <- Lag(LCB[,2], k=1)
     BULLK <- reclass(
-      eval(TSGAP[,1] &         # Gap Up
-      LBCB1 & LCB[,1]),        # 1st candle has long black candle body, 2nd has long white candle body
-      TS)
+      TSGAP[,1] &              # Gap Up
+      LBCB1 & LCB[,1]          # 1st candle has long black candle body, 2nd has long white candle body
+      , TS)
     BEARK <- reclass(
-      eval(TSGAP[,2] &         # Gap Down
-      LWCB1 & LCB[,2]),        # 1st candle has long white candle body, 2nd has long black candle body
-      TS)
+      TSGAP[,2] &             # Gap Down
+      LWCB1 & LCB[,2]         # 1st candle has long white candle body, 2nd has long black candle body
+      , TS)
   } else {
     stop("ignoreShadows must be either TRUE or FALSE")
   }

Modified: pkg/R/CSPLongCandle.R
===================================================================
--- pkg/R/CSPLongCandle.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPLongCandle.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,8 +4,8 @@
   }
   CL <- CandleLength (TS)
   CLMedian <- runMedian (CL[,1], n=n) # use relative CandleLength
-  LongWhiteCandle <- reclass(eval (CL[,1] >= CLMedian*threshold & Cl(TS) >= Op(TS)), TS)
-  LongBlackCandle <- reclass(eval (CL[,1] >= CLMedian*threshold & Op(TS) > Cl(TS)), TS)
+  LongWhiteCandle <- reclass( CL[,1] >= CLMedian*threshold & Cl(TS) >= Op(TS) , TS)
+  LongBlackCandle <- reclass( CL[,1] >= CLMedian*threshold & Op(TS) > Cl(TS) , TS)
   result <- cbind (LongWhiteCandle, LongBlackCandle)
   colnames (result) <- c("LongWhiteCandle", "LongBlackCandle")
   xtsAttributes(result) <- list(bars=1)
@@ -18,8 +18,8 @@
   }
   CBL <- CandleBodyLength (TS)
   CBLMedian <- runMedian (CBL[,1], n=n) # use relative CandleBodyLength
-  LongWhiteCandleBody <- reclass(eval (CBL[,1] >= CBLMedian*threshold & Cl(TS) >= Op(TS)), TS)
-  LongBlackCandleBody <- reclass(eval (CBL[,1] >= CBLMedian*threshold & Op(TS) > Cl(TS)), TS)
+  LongWhiteCandleBody <- reclass( CBL[,1] >= CBLMedian*threshold & Cl(TS) >= Op(TS), TS)
+  LongBlackCandleBody <- reclass( CBL[,1] >= CBLMedian*threshold & Op(TS) > Cl(TS), TS)
   result <- cbind (LongWhiteCandleBody, LongBlackCandleBody)
   colnames (result) <- c("LongWhiteCandleBody", "LongBlackCandleBody")
   xtsAttributes(result) <- list(bars=1)
@@ -32,8 +32,8 @@
   }
   CL <- CandleLength (TS)
   CLMedian <- runMedian (CL[,1], n=n) # use relative CandleLength
-  ShortWhiteCandle <- reclass(eval (CL[,1] < CLMedian*threshold & Cl(TS) >= Op(TS)), TS)
-  ShortBlackCandle <- reclass(eval (CL[,1] < CLMedian*threshold & Op(TS) > Cl(TS)), TS)
+  ShortWhiteCandle <- reclass( CL[,1] < CLMedian*threshold & Cl(TS) >= Op(TS) , TS)
+  ShortBlackCandle <- reclass( CL[,1] < CLMedian*threshold & Op(TS) > Cl(TS ), TS)
   result <- cbind (ShortWhiteCandle, ShortBlackCandle)
   colnames (result) <- c("LongWhiteCandle", "LongBlackCandle")
   xtsAttributes(result) <- list(bars=1)
@@ -46,8 +46,8 @@
   }
   CBL <- CandleBodyLength (TS)
   CBLMedian <- runMedian (CBL[,1], n=n) # use relative CandleBodyLength
-  ShortWhiteCandleBody <- reclass(eval (CBL[,1] < CBLMedian*threshold & Cl(TS) >= Op(TS)), TS)
-  ShortBlackCandleBody <- reclass(eval (CBL[,1] < CBLMedian*threshold & Op(TS) > Cl(TS)), TS)
+  ShortWhiteCandleBody <- reclass( CBL[,1] < CBLMedian*threshold & Cl(TS) >= Op(TS), TS)
+  ShortBlackCandleBody <- reclass( CBL[,1] < CBLMedian*threshold & Op(TS) > Cl(TS), TS)
   result <- cbind (ShortWhiteCandleBody, ShortBlackCandleBody)
   colnames (result) <- c("ShortWhiteCandleBody", "ShortBlackCandleBody")
   xtsAttributes(result) <- list(bars=1)

Modified: pkg/R/CSPMarubozu.R
===================================================================
--- pkg/R/CSPMarubozu.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPMarubozu.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -2,14 +2,14 @@
   if (!is.OHLC(TS)) {
     stop("Price series must contain Open, High, Low and Close.")
   }
-  LongCandle = eval(CandleBodyLength(TS)[,"absCandleBodyLength"] > 
-    ATR(cbind(Hi(TS), Lo(TS), Cl(TS)), n=n, maType="SMA")[,"atr"]*ATRFactor)
+  LongCandle = CandleBodyLength(TS)[,"absCandleBodyLength"] > 
+    ATR(cbind(Hi(TS), Lo(TS), Cl(TS)), n=n, maType="SMA")[,"atr"]*ATRFactor
   CL <- Hi(TS)-Lo(TS)
   BodyHi <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,max))
   BodyLo <- as.xts(apply(cbind(Op(TS),Cl(TS)),1,min))
-  ShortShadow = eval(Hi(TS)-BodyHi <= CL*maxuppershadowCL & BodyLo-Lo(TS) <= CL*maxlowershadowCL)
-  WhiteMarubozu <- reclass(eval( LongCandle & ShortShadow & Op(TS) < Cl(TS)), TS)
-  BlackMarubozu <- reclass(eval( LongCandle & ShortShadow & Op(TS) > Cl(TS)), TS)
+  ShortShadow = Hi(TS)-BodyHi <= CL*maxuppershadowCL & BodyLo-Lo(TS) <= CL*maxlowershadowCL
+  WhiteMarubozu <- reclass( LongCandle & ShortShadow & Op(TS) < Cl(TS), TS)
+  BlackMarubozu <- reclass( LongCandle & ShortShadow & Op(TS) > Cl(TS), TS)
   result <- cbind(WhiteMarubozu, BlackMarubozu)
   colnames(result) <- c("WhiteMarubozu", "BlackMarubozu")
   xtsAttributes(result) <- list(bars=1)

Modified: pkg/R/CSPNHigherClose.R
===================================================================
--- pkg/R/CSPNHigherClose.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPNHigherClose.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -6,10 +6,10 @@
     stop("N has to be a integer >= 1")
   }
   LAGTS <- LagOC(TS,k=0:N)
-  result <- reclass(eval (Cl(LAGTS)[,1] > Cl(LAGTS)[,2]), TS)
+  result <- reclass( Cl(LAGTS)[,1] > Cl(LAGTS)[,2] , TS)
   i <- 2
   while (i < N+1) {
-    result <- reclass(eval (result & (Cl(LAGTS)[,i] > Cl(LAGTS)[,(i+1)])), TS)
+    result <- reclass( result & (Cl(LAGTS)[,i] > Cl(LAGTS)[,(i+1)]) , TS)
     i <- i+1
   }
   colnames(result) <- paste(N, "HigherClose", sep="")
@@ -25,10 +25,10 @@
     stop("N has to be a integer >= 1")
   }
   LAGTS <- LagOC(TS,k=0:N)
-  result <- reclass(eval (Cl(LAGTS)[,1] < Cl(LAGTS)[,2]), TS)
+  result <- reclass( Cl(LAGTS)[,1] < Cl(LAGTS)[,2] , TS)
   i <- 2
   while (i < N+1) {
-    result <- reclass(eval (result & (Cl(LAGTS)[,i] < Cl(LAGTS)[,(i+1)])), TS)
+    result <- reclass( result & (Cl(LAGTS)[,i] < Cl(LAGTS)[,(i+1)]) , TS)
     i <- i+1
   }
   colnames(result) <- paste(N, "LowerClose", sep="")

Modified: pkg/R/CSPPiercingPattern.R
===================================================================
--- pkg/R/CSPPiercingPattern.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPPiercingPattern.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -5,11 +5,11 @@
   LAGTS <- LagOC(TS, k=1)
   LongCandleBody <- CSPLongCandleBody(LAGTS, n=n, threshold=minbodysizeMedian)
 
-  PiercingPattern <- reclass(eval (
+  PiercingPattern <- reclass(
     LongCandleBody[,"LongBlackCandleBody"] & # first candle is black and longer than median of past n candles
     Op(TS)<Cl(LAGTS) &                 # second candle opens lower than close of 1st candle
     Cl(TS)>=(Op(LAGTS)+Cl(LAGTS))/2 &  # second candle closes at or higher than half of 1st candles' body
-    Cl(TS)<Op(LAGTS) ), TS)            # close of second candle is lower than open of 1st candle
+    Cl(TS)<Op(LAGTS) , TS)             # close of second candle is lower than open of 1st candle
   colnames(PiercingPattern) <- c("PiercingPattern")
   xtsAttributes(PiercingPattern) <- list(bars=2)
   return(PiercingPattern)

Modified: pkg/R/CSPStar.R
===================================================================
--- pkg/R/CSPStar.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPStar.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -8,19 +8,19 @@
   GAP1 <- CSPGap(LAG1TS, ignoreShadows=TRUE) # gap between the first and second candle
   SCB1 <- CSPShortCandleBody (LAG1TS, n=n, threshold=maxbodysizeMedian)# second candle body is shorter than average
   MorningStar <- reclass(
-    eval(LCB2[,2] &                # 1st candle: long black candle body
+    LCB2[,2] &                     # 1st candle: long black candle body
     GAP1[,2] &                     # gap down from 1st to 2nd candle
     (SCB1[,1] | SCB1[,2]) &        # 2nd candle: short black or white candle body
     Cl(TS) > Op(TS) &              # 3rd candle is white
-    Cl(TS) > (Op(LAG2TS)+Cl(LAG2TS))/2), # 3rd candle closes above middle of 1st candle body
-    TS)
+    Cl(TS) > (Op(LAG2TS)+Cl(LAG2TS))/2 # 3rd candle closes above middle of 1st candle body
+    , TS)
   EveningStar <- reclass(
-    eval(LCB2[,1] &                # 1st candle: long white candle body
+    LCB2[,1] &                     # 1st candle: long white candle body
     GAP1[,1] &                     # gap up from 1st to 2nd candle
     (SCB1[,1] | SCB1[,2]) &        # 2nd candle: short black or white candle body
     Cl(TS) < Op(TS) &              # third candle is white
-    Cl(TS) < (Op(LAG2TS)+Cl(LAG2TS))/2), # 3rd candle closes below middle of 1st candle body
-    TS)
+    Cl(TS) < (Op(LAG2TS)+Cl(LAG2TS))/2 # 3rd candle closes below middle of 1st candle body
+    , TS)
   result <- cbind(MorningStar, EveningStar)
   colnames(result) <- c("MorningStar", "EveningStar")
   xtsAttributes(result) <- list(bars=3)

Modified: pkg/R/CSPStomache.R
===================================================================
--- pkg/R/CSPStomache.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPStomache.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -3,10 +3,10 @@
     stop("Price series must contain Open and Close.")
   }
   LAGTS <- LagOC(TS, k=1)
-  AboveTheStomache <- reclass(eval( Op(LAGTS)>Cl(LAGTS) & Cl(TS)>Op(TS)
-    & Op(TS)>=((Op(LAGTS)+Cl(LAGTS))/2) ), TS)
-  BelowTheStomache <- reclass(eval( Cl(LAGTS)>Op(LAGTS) & Op(TS)>Cl(TS)
-    & ((Op(LAGTS)+Cl(LAGTS))/2>=Op(TS)) ), TS)
+  AboveTheStomache <- reclass( Op(LAGTS)>Cl(LAGTS) & Cl(TS)>Op(TS)
+    & Op(TS)>=((Op(LAGTS)+Cl(LAGTS))/2) , TS)
+  BelowTheStomache <- reclass( Cl(LAGTS)>Op(LAGTS) & Op(TS)>Cl(TS)
+    & ((Op(LAGTS)+Cl(LAGTS))/2>=Op(TS)) , TS)
   result <- cbind(AboveTheStomache, BelowTheStomache)
   colnames(result) <- c("AboveTheStomache", "BelowTheStomache")
   xtsAttributes(result) <- list(bars=2)

Modified: pkg/R/CSPTasukiGap.R
===================================================================
--- pkg/R/CSPTasukiGap.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPTasukiGap.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -6,19 +6,19 @@
   LAG1TS <- LagOHLC(TS, k=1)
   GAP1 <- CSPGap(LAG1TS, ignoreShadows=FALSE)
   UTG <- reclass(
-    eval(Op(LAG2TS) < Cl(LAG2TS) &        # 1st candle: white
+    Op(LAG2TS) < Cl(LAG2TS) &             # 1st candle: white
     GAP1[,1] &                            # Up Gap btwn 1st and 2nd candle
     Op(LAG1TS) < Cl(LAG1TS) &             # 2nd candle: white
     Op(TS) < Cl(LAG1TS) & Op(TS) > Op(LAG1TS)  & # 3rd candle opens within 2nd candle's body
-    Cl(TS) < Lo(LAG1TS) & Cl(TS) > Hi(LAG2TS)),  # 3rd candle closes within gap of 1st and 2nd candle
-    TS)
+    Cl(TS) < Lo(LAG1TS) & Cl(TS) > Hi(LAG2TS)    # 3rd candle closes within gap of 1st and 2nd candle
+    , TS)
   DTG <- reclass(
-    eval(Op(LAG2TS) > Cl(LAG2TS) &        # 1st candle: black
+    Op(LAG2TS) > Cl(LAG2TS) &             # 1st candle: black
     GAP1[,2] &                            # Down Gap btwn 1st and 2nd candle
     Op(LAG1TS) > Cl(LAG1TS) &             # 2nd candle: black
     Op(TS) > Cl(LAG1TS) & Op(TS) < Op(LAG1TS)  & # 3rd candle opens within 2nd candle's body
-    Cl(TS) > Hi(LAG1TS) & Cl(TS) < Lo(LAG2TS)),  # 3rd candle closes within gap of 1st and 2nd candle
-    TS)
+    Cl(TS) > Hi(LAG1TS) & Cl(TS) < Lo(LAG2TS)    # 3rd candle closes within gap of 1st and 2nd candle
+    , TS)
   result <- cbind(UTG, DTG)
   colnames(result) <- c("UpsideTasukiGap", "DownsideTasukiGap")
   xtsAttributes(result) <- list(bars=3)

Modified: pkg/R/CSPThreeInside.R
===================================================================
--- pkg/R/CSPThreeInside.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPThreeInside.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -6,17 +6,17 @@
   LAGTS1 <- LagOHLC(TS, k=1)   # second candle
   LAGHARAMI <- CSPHarami(LAGTS1)
   TIUP <- reclass(
-    eval(LAGHARAMI[,1] &       # bullish harami
+    LAGHARAMI[,1] &            # bullish harami
     Cl(TS)>Op(TS) &            # 3rd candle is white
     Cl(TS)>Cl(LAGTS1) &        # close of 3rd candle greater than close of 2nd candle
-    Cl(TS)>LAGTS2),            # close of 3rd candle greater than open of 1st candle
-    TS)
+    Cl(TS)>LAGTS2              # close of 3rd candle greater than open of 1st candle
+    , TS)
   TIDOWN <- reclass(
-    eval(LAGHARAMI[,2] &       # bearish harami
+    LAGHARAMI[,2] &       # bearish harami
     Cl(TS)<Op(TS) &            # 3rd candle is black
     Cl(TS)<Cl(LAGTS1) &        # close of 3rd candle lower than close of 2nd candle
-    Cl(TS)<LAGTS2),            # close of 3rd candle lower than open of 1st candle
-    TS)
+    Cl(TS)<LAGTS2              # close of 3rd candle lower than open of 1st candle
+    , TS)
   result <- cbind(TIUP, TIDOWN)
   colnames(result) <- c("ThreeInsideUp", "ThreeInsideDown")
   xtsAttributes(result) <- list(bars=3)

Modified: pkg/R/CSPThreeMethods.R
===================================================================
--- pkg/R/CSPThreeMethods.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPThreeMethods.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -12,25 +12,25 @@
   LC4 <- CSPLongCandleBody(LAG4TS, n=n, threshold=threshold)
   LC0 <- CSPLongCandleBody(TS, n=n, threshold=threshold)
   RTM <- reclass(
-    eval (LC4[,1] &               # 1st candle: long white candle body
+    LC4[,1] &                     # 1st candle: long white candle body
     Op(LAG3TS) > Cl(LAG3TS) &     # 2nd candle: black candle
     Op(LAG1TS) > Cl(LAG1TS) &     # 4th candle: black candle
     MAXOP < Hi(LAG4TS) & MAXOP > Lo(LAG4TS) & # candle bodies 2,3,4 within range of 1st candle
     MAXCL < Hi(LAG4TS) & MAXCL > Lo(LAG4TS) &
     MINOP < Hi(LAG4TS) & MINOP > Lo(LAG4TS) &
     MINCL < Hi(LAG4TS) & MINCL > Lo(LAG4TS) &
-    LC0[,1] & Cl(TS) > Cl(LAG4TS)),# 5th candle: long white candle body that closes higher than 1st candle
-    TS)
+    LC0[,1] & Cl(TS) > Cl(LAG4TS) # 5th candle: long white candle body that closes higher than 1st candle
+    , TS)
   FTM <- reclass(
-    eval (LC4[,2] &                # 1st candle: long black candle body
+    LC4[,2] &                      # 1st candle: long black candle body
     Op(LAG3TS) < Cl(LAG3TS) &      # 2nd candle: white candle
     Op(LAG1TS) < Cl(LAG1TS) &      # 4th candle: white candle
     MAXOP < Hi(LAG4TS) & MAXOP > Lo(LAG4TS) & # candle bodies 2,3,4 within range of 1st candle
     MAXCL < Hi(LAG4TS) & MAXCL > Lo(LAG4TS) &
     MINOP < Hi(LAG4TS) & MINOP > Lo(LAG4TS) &
     MINCL < Hi(LAG4TS) & MINCL > Lo(LAG4TS) &
-    LC0[,2] & Cl(TS) < Cl(LAG4TS)),# 5th candle: long black candle  body that closes lower than 1st candle
-    TS)
+    LC0[,2] & Cl(TS) < Cl(LAG4TS) # 5th candle: long black candle  body that closes lower than 1st candle
+    , TS)
   result <- cbind (RTM, FTM)
   colnames (result) <- c("RisingThreeMethods", "FallingThreeMethods")
   xtsAttributes(result) <- list(bars=5)

Modified: pkg/R/CSPThreeOutside.R
===================================================================
--- pkg/R/CSPThreeOutside.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPThreeOutside.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,12 +4,12 @@
   }
   LAGTS1 <- LagOHLC(TS, k=1)      # second candle
   LAGENGULFING <- CSPEngulfing(LAGTS1)
-  TOUP <- reclass(eval(LAGENGULFING[,1] &   # bullish engulfing
+  TOUP <- reclass( LAGENGULFING[,1] &       # bullish engulfing
     Cl(TS)>Op(TS) &                         # 3rd candle is white
-    Cl(TS)>Cl(LAGTS1)), TS)                 # 3rd candle closes above 2nd candle
-  TODOWN <- reclass(eval(LAGENGULFING[,2] & # bearish engulfing
+    Cl(TS)>Cl(LAGTS1) , TS)                 # 3rd candle closes above 2nd candle
+  TODOWN <- reclass(LAGENGULFING[,2] &      # bearish engulfing
     Cl(TS)<Op(TS) &                         # 3rd candle is black
-    Cl(TS)<Cl(LAGTS1)), TS)                 # 3rd candle closes below 2nd candle
+    Cl(TS)<Cl(LAGTS1) , TS)                 # 3rd candle closes below 2nd candle
   result <- cbind(TOUP, TODOWN)
   colnames(result) <- c("ThreeOutsideUp", "ThreeOutsideDown")
   xtsAttributes(result) <- list(bars=3)

Modified: pkg/R/CSPThreeWhiteSoldiers.R
===================================================================
--- pkg/R/CSPThreeWhiteSoldiers.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/CSPThreeWhiteSoldiers.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,17 +4,17 @@
   }
   THREELWCB <- CSPNLongWhiteCandleBodies(TS, N=3, n=n, threshold=minbodysizeMedian)
   LAGTS <- LagOC(TS,k=0:2)  # lags 0, 1, 2 periods
-  result <- reclass(eval(THREELWCB[,1] & 
+  result <- reclass( THREELWCB[,1] & 
     Op(LAGTS)[,1] > Op(LAGTS)[,2] & # third open higher than second
     Op(LAGTS)[,2] > Op(LAGTS)[,3] & # second open higher than first
     Cl(LAGTS)[,1] > Cl(LAGTS)[,2] & # third close higher than second
-    Cl(LAGTS)[,2] > Cl(LAGTS)[,3]), TS) # second close higher than first
+    Cl(LAGTS)[,2] > Cl(LAGTS)[,3] , TS) # second close higher than first
   # in strict mode the candles should open within the previous
   # candle's body
   if (strict==TRUE) {
-    result <- reclass(eval(result &
+    result <- reclass( result &
       Op(LAGTS)[,1] <= Cl(LAGTS)[,2] & # third open within second candle body
-      Op(LAGTS)[,2] <= Cl(LAGTS)[,3]), TS) # second open within first candle body
+      Op(LAGTS)[,2] <= Cl(LAGTS)[,3] , TS) # second open within first candle body
   }
   colnames(result) <- c("ThreeWhiteSoldiers")
   xtsAttributes(result) <- list(bars=3)
@@ -27,17 +27,17 @@
   }
   THREELBCB <- CSPNLongBlackCandleBodies(TS, N=3, n=n, threshold=minbodysizeMedian)
   LAGTS <- LagOC(TS,k=0:2)
-  result <- reclass(eval(THREELBCB[,1] & 
+  result <- reclass( THREELBCB[,1] & 
     Op(LAGTS)[,1] < Op(LAGTS)[,2] &
     Op(LAGTS)[,2] < Op(LAGTS)[,3] &
     Cl(LAGTS)[,1] < Cl(LAGTS)[,2] &
-    Cl(LAGTS)[,2] < Cl(LAGTS)[,3]), TS)
+    Cl(LAGTS)[,2] < Cl(LAGTS)[,3] , TS)
   # in strict mode the candles should open within the previous
   # candle's body
   if (strict==TRUE) {
-    result <- reclass(eval(result &
+    result <- reclass( result &
       Op(LAGTS)[,1] >= Cl(LAGTS)[,2] &
-      Op(LAGTS)[,2] >= Cl(LAGTS)[,3]), TS)
+      Op(LAGTS)[,2] >= Cl(LAGTS)[,3] , TS)
   }
   colnames(result) <- c("ThreeBlackCrows")
   xtsAttributes(result) <- list(bars=3)

Modified: pkg/R/TrendDetectionChannel.R
===================================================================
--- pkg/R/TrendDetectionChannel.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/TrendDetectionChannel.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -3,9 +3,9 @@
     stop("Price series must contain Open, High, Low and Close.")
   }
   Channel <- DonchianChannel2(cbind(Hi(TS),Lo(TS)), n=n)
-  UpTrend <- eval(Cl(TS) > Lo(Channel)+(Hi(Channel)-Lo(Channel))*(1-DCSector))
-  DownTrend <- eval(Cl(TS) < Lo(Channel)+(Hi(Channel)-Lo(Channel))*DCSector)
-  NoTrend <- eval(!(UpTrend | DownTrend))
+  UpTrend <- Cl(TS) > Lo(Channel)+(Hi(Channel)-Lo(Channel))*(1-DCSector)
+  DownTrend <- Cl(TS) < Lo(Channel)+(Hi(Channel)-Lo(Channel))*DCSector
+  NoTrend <- !(UpTrend | DownTrend)
   Trend <- UpTrend+ DownTrend*(-1)
   result <- cbind(UpTrend, NoTrend, DownTrend, Trend)
   colnames(result) <- c("UpTrend", "NoTrend", "DownTrend", "Trend")

Modified: pkg/R/TrendDetectionSMA.R
===================================================================
--- pkg/R/TrendDetectionSMA.R	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/R/TrendDetectionSMA.R	2012-04-22 12:13:24 UTC (rev 17)
@@ -4,9 +4,9 @@
   }
   Close <- Cl(TS)
   CloseToSMA <- Close/SMA(Close,n=n)
-  UpTrend <- eval(CloseToSMA[,1] > 1)
-  NoTrend <- eval(CloseToSMA[,1] == 1)
-  DownTrend <- eval(CloseToSMA[,1] < 1)
+  UpTrend <- CloseToSMA[,1] > 1
+  NoTrend <- CloseToSMA[,1] == 1
+  DownTrend <- CloseToSMA[,1] < 1
   Trend <- UpTrend+ DownTrend*(-1)
   result <- cbind(UpTrend, NoTrend, DownTrend, Trend)
   colnames(result) <- c("UpTrend", "NoTrend", "DownTrend", "Trend")

Modified: pkg/man/CSPDarkCloudCover.Rd
===================================================================
--- pkg/man/CSPDarkCloudCover.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPDarkCloudCover.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -34,8 +34,7 @@
   # the lag of 2 periods of the time series for trend detection
   # ensures that the uptrend is active \emph{before} the
   # dark cloud cover occurs.
-  eval(CSPDarkCloudCover(YHOO) & 
-    TrendDetectionChannel(lag(YHOO,k=2))[,"UpTrend"])
+  CSPDarkCloudCover(YHOO) & TrendDetectionChannel(lag(YHOO,k=2))[,"UpTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPDoji.Rd
===================================================================
--- pkg/man/CSPDoji.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPDoji.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -40,7 +40,7 @@
   CSPDoji(YHOO, DojiBLRatio=0)
   
   # filter for gravestone doji patterns that occur in uptrends
-  eval(CSPDoji(YHOO)[,"GravestoneDoji"] & TrendDetectionChannel(YHOO)[,"UpTrend"])
+  CSPDoji(YHOO)[,"GravestoneDoji"] & TrendDetectionChannel(YHOO)[,"UpTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPEngulfing.Rd
===================================================================
--- pkg/man/CSPEngulfing.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPEngulfing.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -29,12 +29,13 @@
   \url{http://www.candlesticker.com/Bullish.asp}\cr
   \url{http://www.candlesticker.com/Bearish.asp}
 }
-\note{Trend detection prior to the formation is not implemented yet}
+\note{The function filters patterns that look like engulfing pattern, without considering the current trend direction. If only pattern in uptrends/downtrends should be filtered, a external trend detection function must be used. See examples.}
 \seealso{}
 \examples{
 \dontrun{
   getSymbols('YHOO',adjust=TRUE)
   CSPEngulfing(YHOO)
+  CSPEngulfing(YHOO)[,"Bear.Engulfing"] & TrendDetectionChannel(YHOO)[,"UpTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPHammer.Rd
===================================================================
--- pkg/man/CSPHammer.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPHammer.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -35,10 +35,10 @@
   getSymbols('YHOO',adjust=TRUE)
   
   # filter for hammer patterns
-  CSPHammer(YHOO
+  CSPHammer(YHOO)
   
   # filter for hammer patterns that occur in downtrends
-  eval(CSPHammer(YHOO) & TrendDetectionChannel(YHOO)[,"DownTrend"])
+  CSPHammer(YHOO) & TrendDetectionChannel(YHOO)[,"DownTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPHangingMan.Rd
===================================================================
--- pkg/man/CSPHangingMan.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPHangingMan.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -38,7 +38,7 @@
   CSPHangingMan(YHOO)
   
   # filter for hanging man patterns that occur in uptrends
-  eval(CSPHangingMan(YHOO) & TrendDetectionChannel(YHOO)[,"UpTrend"])
+  CSPHangingMan(YHOO) & TrendDetectionChannel(YHOO)[,"UpTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPHarami.Rd
===================================================================
--- pkg/man/CSPHarami.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPHarami.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -37,8 +37,8 @@
   CSPHarami(YHOO)
   
   # filter for bullish harami that occour in downtrends
-  BullHarami <- eval(CSPHarami(YHOO)[,"Bull.Harami"] & 
-    TrendDetectionChannel(lag(YHOO,k=2))[,"DownTrend"])
+  BullHarami <- CSPHarami(YHOO)[,"Bull.Harami"] & 
+    TrendDetectionChannel(lag(YHOO,k=2))[,"DownTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPPiercingPattern.Rd
===================================================================
--- pkg/man/CSPPiercingPattern.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPPiercingPattern.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -34,7 +34,7 @@
   # the lag of 2 periods of the time series for trend detection
   # ensures that the uptrend is active \emph{before} the
   # dark cloud cover occurs.
-  eval(CSPPiercingPattern(YHOO) & TrendDetectionChannel(lag(YHOO,k=2))[,"DownTrend"])
+  CSPPiercingPattern(YHOO) & TrendDetectionChannel(lag(YHOO,k=2))[,"DownTrend"]
 }
 }
 \keyword{}

Modified: pkg/man/CSPStar.Rd
===================================================================
--- pkg/man/CSPStar.Rd	2012-04-19 15:38:26 UTC (rev 16)
+++ pkg/man/CSPStar.Rd	2012-04-22 12:13:24 UTC (rev 17)
@@ -44,8 +44,8 @@
   CSPStar(YHOO, maxbodysizeMedian=.5)
   
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/candlesticks -r 17


More information about the Candlesticks-commits mailing list