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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 22 18:53:44 CEST 2012


Author: wotuzu17
Date: 2012-05-22 18:53:44 +0200 (Tue, 22 May 2012)
New Revision: 20

Added:
   pkg/R/CSPInvertedHammer.R
   pkg/man/CSPInvertedHammer.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
Log:
removed HangingMan, added InvertedHammer

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2012-05-06 14:03:16 UTC (rev 19)
+++ pkg/DESCRIPTION	2012-05-22 16:53:44 UTC (rev 20)
@@ -1,8 +1,8 @@
 Package: candlesticks
 Type: Package
 Title: Candlestick Pattern Recognition
-Version: 0.1-15
-Date: 2012-05-06
+Version: 0.1-16
+Date: 2012-05-22
 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/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2012-05-06 14:03:16 UTC (rev 19)
+++ pkg/NAMESPACE	2012-05-22 16:53:44 UTC (rev 20)
@@ -4,9 +4,9 @@
 export(CSPEngulfing)
 export(CSPGap)
 export(CSPHammer)
-export(CSPHangingMan)
 export(CSPHarami)
 export(CSPInsideDay)
+export(CSPInvertedHammer)
 export(CSPKicking)
 export(CSPLongCandle)
 export(CSPLongCandleBody)

Added: pkg/R/CSPInvertedHammer.R
===================================================================
--- pkg/R/CSPInvertedHammer.R	                        (rev 0)
+++ pkg/R/CSPInvertedHammer.R	2012-05-22 16:53:44 UTC (rev 20)
@@ -0,0 +1,16 @@
+CSPInvertedHammer <- function(TS, minuppershadowCL=2/3, maxlowershadowCL=.1, minbodyCL=.1) {
+  if (!is.OHLC(TS)) {
+    stop("Price series must contain Open, High, Low and Close.")
+  }
+  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))
+  InvertedHammer <- 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
+    ,TS)
+  colnames(InvertedHammer) <- c("InvertedHammer")
+  xtsAttributes(InvertedHammer) <- list(bars=1)
+  return (InvertedHammer)
+}

Added: pkg/man/CSPInvertedHammer.Rd
===================================================================
--- pkg/man/CSPInvertedHammer.Rd	                        (rev 0)
+++ pkg/man/CSPInvertedHammer.Rd	2012-05-22 16:53:44 UTC (rev 20)
@@ -0,0 +1,44 @@
+\name{CSPInvertedHammer}
+\alias{CSPInvertedHammer}
+\alias{InvertedHammer}
+\title{Inverted Hammer Candlestick Pattern}
+\description{Look for Inverted Hammer Pattern in a OHLC price series}
+\usage{CSPInvertedHammer(TS, minuppershadowCL=2/3, maxlowershadowCL=.1, minbodyCL=.1)}
+\arguments{
+  \item{TS}{xts Time Series containing Open, High, Low and Close Prices}
+  \item{minuppershadowCL}{minimum upper shadow to candle length ratio}
+  \item{maxlowershadowCL}{maximum tolerated lower shadow to candle length ratio}
+  \item{minbodyCL}{minimum body to candle length ratio}
+}
+\details{
+Number of candle lines: \bold{1}\cr\cr
+The inverted hammer has got a long upper shadow, a small body at the bottom of the candle, and no or only a very short lower shadow.\code{\link{Hammer}}.
+}
+\value{
+  A xts object containing the column:
+  \item{InvertedHammer}{TRUE if inverted hammer pattern detected}
+}
+\author{Andreas Voellenklee}
+\references{
+The following site(s) were used to code/document this candlestick pattern:\cr
+  \url{http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:introduction_to_candlesticks}\cr
+}
+\note{The function filters candles that look like inverted hammers, without considering the current trend direction. If only inverted hammer patterns in a uptrend should be filtered, a external trend detection function must be used. See examples.}
+\seealso{
+\code{\link{CSPDoji}}
+\code{\link{CSPHammer}}
+\code{\link{TrendDetectionChannel}}
+\code{\link{TrendDetectionSMA}}
+}
+\examples{
+\dontrun{
+  getSymbols('YHOO',adjust=TRUE)
+  
+  # filter for hanging man patterns
+  CSPInvertedHammer(YHOO)
+  
+  # filter for hanging man patterns that occur in downtrends
+  CSPInvertedHammer(YHOO) & TrendDetectionChannel(YHOO)[,"DownTrend"]
+}
+}
+\keyword{}



More information about the Candlesticks-commits mailing list