Rules: 1. The first candlestick is a long green candlestick. 2. The second candlestick is a long red candlestick which opens above the high of the first candlestick and closes near the close of the first candlestick. Pattern Type: Bearish Reversal.
' Assign the parameters to script variables. _symbolIndex = symbolIndex _minCandleSize = minCandleSize _maxCloseDifference = maxCloseDifference
' Get the opening prices of the symbol, indexed by bar index. Define open() As Number = BarOpen(_symbolIndex, barIndex, 2) ' Get the highest prices of the symbol, indexed by bar index. Define high() As Number = BarHigh(_symbolIndex, barIndex, 2) ' Get the lowest prices of the symbol, indexed by bar index. Define low() As Number = BarLow(_symbolIndex, barIndex, 2) ' Get the closing prices of the symbol, indexed by bar index. Define close() As Number = BarClose(_symbolIndex, barIndex, 2) ' Check whether the first candlestick matches. If (open(1) < close(1) And (100 * (close(1) - open(1)) / open(1) > _minCandleSize)) Then ' Check whether the second candlestick matches. If (open(0) > close(0) And _ open(0) > high(1) And _ (100 * (open(0) - close(0)) / close(0) > _minCandleSize) And _ 100 * MathAbs((close(0) - close(1)) / close(1)) < _maxCloseDifference) Then Return 2 End If End If Return 0