knitr::opts_chunk$set(echo = TRUE) library(quantmod) library(CandleStickPattern) MSFT <- MSFT['2011-07-08/2011-07-19'] #getSymbols("MSFT", from = "2011-07-08" , to = "2011-07-19")
This package finds common candle stick patterns using daily data (OHLC data).
The current version package covers the following patterns:
Doji family (1-day pattern)
doji()
dragonfly.doji()
gravestone.doji()
Hammer family (2-day pattern)
hammer()
inverted.hammer
Engulfing family (2-day pattern)
bullish.engulf()
bearish.engulf()
Harami family (2-day pattern)
bullish.engulf()
bearish.harami()
Reversal family (2-day pattern)
piercing.line()
dark.cloud.cover()
Kicking family (2-day pattern)
kick.up()
kick.down()
Three-in-a-row (3-day pattern)
three.white.soliders()
three.black.crows()
Star (3-day pattern)
morning.star()
evening.star()
Three Method (5-day pattern)
rising.three()
falling.three()
Moreover, it captures trends using exponential moving average (EMA):
up.trend()
down.trend()
To install this package, it is the easist to install devtools
package first:
install.packages("devtools")
Now load the package using library()
library(devtools)
Then we can use the install_github
to get the package directly:
install_github("kochiuyu/CandleStickPattern")
Finally, we load the package using library()
library(CandleStickPattern)
You can see the details of how each function works in vignette
The following demonstrates the usage of the function doji()
using Microsoft (ticker: MSFT). We use quantmod package to download data:
library(quantmod) getSymbols("MSFT", from = "2011-07-08" , to = "2011-07-19")
We first plot the candle chart first:
candleChart(MSFT,theme='white')
We can see that July 11, 12, 13, and 18 are likely to follow doji pattern. Let us see if we can capture using the function doji
:
doji(MSFT)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.