Rules: 1. The first candlestick is a long green candlestick. 2. The second candlestick is a short red candlestick which gaps above the first candlestick. 3. The third candlestick is a short red or green candlestick which open and close below the open of the second candlestick but is in the range of the first candlestick. 4. The fourth candlestick is a short red candlestick which opens below the open of the second candlestick but is in the range of the first candlestick. 5. The fifth candlestick is a green candlestick which opens above the fourth candlestick and closes above the first candlestick close. Pattern Type: Bullish Continuation.
' Assign the parameters to script variables. _symbolIndex = symbolIndex _minCandleSize = minCandleSize
' Get the opening prices of the symbol, indexed by bar index. Define open() As Number = BarOpen(_symbolIndex, barIndex, 5) ' Get the closing prices of the symbol, indexed by bar index. Define close() As Number = BarClose(_symbolIndex, barIndex, 5) ' Check whether the first candlestick matches. If (open(4) < close(4) And _ 100 * (close(4) - open(4)) / open(4) > _minCandleSize) Then ' Check whether the second candlestick matches. If (open(3) > close(3) And _ close(4) < close(3) And _ -100 * (close(4) - open(4)) / open(4) < _minCandleSize) Then ' Check whether the third candlestick matches. If (open(2) < close(2) And close(2) < open(3) And open(2) > open(4)) Or _ (open(2) > close(2) And close(2) > open(4) And open(2) < open(3)) Then ' Check whether the fourth candlestick matches. If (open(1) > close(1) And _ close(2) > open(4) And _ open(2) < open(3)) Then ' Check whether the fifth candlestick matches. If (open(0) < close(0) And _ open(0) > open(1) And _ close(0) > close(4) And _ close(0) > open(3)) Then Return 5 End If End If End If End If End If Return 0