Rules: 1. The first candlestick is a long green candlestick. 2. The second candlestick is a short red or green candlestick. 3. The third candlestick is a long red candlestick which closes in the body of the first candlestick. Pattern Type: Bearish Reversal.
' 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, 3) ' Get the highest prices of the symbol, indexed by bar index. Define high() As Number = BarHigh(_symbolIndex, barIndex, 3) ' Get the lowest prices of the symbol, indexed by bar index. Define low() As Number = BarLow(_symbolIndex, barIndex, 3) ' Get the closing prices of the symbol, indexed by bar index. Define close() As Number = BarClose(_symbolIndex, barIndex, 3) ' Check whether the first candlestick matches. If (open(2) < close(2) And _ 100 * (close(2) - open(2)) / open(2) > _minCandleSize) Then ' Check whether the second candlestick matches. If (high(2) < low(1) And _ MathAbs(100 * (high(1) - low(1)) / high(1)) < _minCandleSize) Then ' Check whether the third candlestick matches. If (open(0) > close(0) And _ close(0) > open(2) And _ close(0) < close(2)) Then Return 3 End If End If End If Return 0