6.5 Engulfing Patterns
Engulfing Patterns is a 2-day pattern. Engulfing means that real body of day 1 candle is completely wihtin that of day 1. There are two types of engulfing patterns depends on the price movement:
- Bullish engulfing
- Bearish engulfing
6.5.1 Bullish Engulfing
Bullish signal as bullish force dominates:
- Bearish Candle on Day 1
- Bullish Candle on Day 2
- Real body of Day 1 Candle within that of Day 2.
Here is an exmample:
We can identify the pattern through the following code:
engulf <-c(0)
for (i in 2:N){
if (D[i-1]>0 &&
U[i]>0 &&
OP[i]<=CL[i-1] &&
CL[i]>=OP[i-1]){
engulf[i] <- 1
} else{
engulf[i] <- 0
}
}
engulf <- reclass(engulf,Cl(MSFT))
Let us check if our code does the job:
## [,1]
## 2011-11-02 0
## 2011-11-03 0
## 2011-11-04 0
## 2011-11-07 1
## 2011-11-08 0