6.8 Median Reversal
Median reseral patterns are 2-day patterns. It is a mixture of engulfing pattern and harami.
6.8.1 Piercing Line
Bullish signal
- Bearish candle on day 1
- Bullish candle on day 2
- Close on day 2 > mid point of day 1 body
Here is an exmample:
We can identify the pattern through the following code:
pierce <-c(NA)
for (i in 2:length(Cl(MSFT))){
if (D[i-1]>0 &&
U[i]>0 &&
CL[i]>=M[i-1]){
pierce[i] <- 1
} else{
pierce[i] <- 0
}
}
pierce <- reclass(pierce,Cl(MSFT))
Let us check if our code does the job:
## [,1]
## 2011-07-26 0
## 2011-07-27 0
## 2011-07-28 1
## 2011-07-29 0