pythonta-libcandlesticks

TA-lib is not properly detecting Engulfing candle


As you see in the attached image, there was a Bearish Engulfing candle on December 18. enter image description here

But when I see the same data and engulfing value, it shows something else, in fact 0.

Below is the function computing, detecting engulfing candle pattern:

def detect_engulfing_pattern(tsla_df):
    df = tsla_df.rename(columns={"Open": "open", "High": "high", "Low": "low", "Close": "close"})
    df['engulfing'] = talib.CDLENGULFING(df['open'], df['high'], df['low'], df['close'])
    return df

enter image description here


Solution

  • It’s not an engulfing pattern because it only compares one bar to the next, not across multiple bars.

    I highlighted the part that I think you missed: candles