Chapter 6 Candle Stick Pattern
In this chapter, we learn how to use R to detect the following candle stick patterns.
- 1-day patterns:
- 2-day patterns:
- median reversal
- two in a row (kicking)
- 3-day patterns:
- 5-day pattern:
- three method
Throughout this chapter, we use Microsoft (ticker: MSFT) to do demonstration
To make our code more compact, let us define the following:
OP <- as.numeric(Op(MSFT)) LO <- as.numeric(Lo(MSFT)) HI <- as.numeric(Hi(MSFT)) CL <- as.numeric(Cl(MSFT)) N <- nrow(MSFT)
We have used as.numeric to take out the timestamp of the xts data for comparsion.