I used your signal generator code: def signal_generator(df):
    # Calculate EMA and MA lines
    df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
    df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
    df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
    df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
    df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
    df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
    df['MA10'] = df['Close'].rolling(window=10).mean()
    df['MA20'] = df['Close'].rolling(window=20).mean()
    df['MA50'] = df['Close'].rolling(window=50).mean()
    df['MA100'] = df['Close'].rolling(window=100).mean()
    # Extract necessary prices from df
    current_price = df.Close.iloc[-1]
    previous_close = df.Close.iloc[-2]

    
    # Check for EMA crossover - buy signal
    if df.EMA10.iloc[-1] > df.EMA50.iloc[-1] and current_price > min(df[['EMA10', 'EMA50']].iloc[-1]):
        ema_signal = 'buy'
    # Check for EMA crossover - sell signal
    elif df.EMA10.iloc[-1] < df.EMA50.iloc[-1] and current_price < max(df[['EMA10', 'EMA50']].iloc[-1]):
        ema_signal = 'sell'
    else:
        ema_signal = None

    # Check for bullish candlestick patterns
    if df.Close.iloc[-1] > df.Open.iloc[-1] and df.Low.iloc[-1] > min(df[['Open', 'Close']].iloc[-1]):
        candle_signal = 'buy'
    # Check for bearish candlestick patterns
    elif df.Close.iloc[-1] < df.Open.iloc[-1] and df.High.iloc[-1] < max(df[['Open', 'Close']].iloc[-1]):
        candle_signal = 'sell'
    else:
        candle_signal = None

    # Check for bullish/bearish candlestick patterns
    open = df.Open.iloc[-1]
    close = df.Close.iloc[-1]
    previous_open = df.Open.iloc[-2]
    previous_close = df.Close.iloc[-2]

    # Bearish pattern
    if open > close and previous_open < previous_close and close < previous_open and open >= previous_close:
        candle_pattern = 'sell'
    # Bullish pattern
    elif open < close and previous_open > previous_close and close > previous_open and open <= previous_close:
        candle_pattern = 'buy'
    else:
        candle_pattern = None

    # Combine EMA and candlestick signals
    if ema_signal == 'buy' and candle_signal == 'buy':
        return 'buy'
    elif ema_signal == 'sell' and candle_signal == 'sell':
        return 'sell'

    # Check for bullish/bearish trends
    elif current_price > max(df[['EMA5', 'EMA20', 'EMA50', 'EMA100', 'EMA200']].iloc[-1]):
        return 'buy'
    elif current_price < min(df[['EMA5', 'EMA20', 'EMA50', 'EMA100', 'EMA200']].iloc[-1]):
        return 'sell'

    # Check if the current price is higher than the previous close, indicating buying pressure
    if current_price > previous_close:
        return 'buy'
    # Check if the current price is lower than the previous close, indicating selling pressure
    elif current_price < previous_close:
        return 'sell'

    # Check if there is a candlestick pattern
    if candle_pattern == 'buy':
        return 'buy'
    elif candle_pattern == 'sell':
        return 'sell'
    else: 
        return ''
Can you add candle_analyze system by my code :    open = df.open.iloc[-1]
    close = df.close.iloc[-1]
    previous_open = df.open.iloc[-2]
    previous_close = df.close.iloc[-2]

        #Bearish pattern
    if (open>close and 
    previous_open<previous_close and
    close<previous_open and 
    open>=previous_close):
        return 'sell'

        #Bullish pattern
    elif (open<close and
    previous_open>previous_close and
    close>previous_open and
    open<=previous_close):
        return 'buy'
        
        #No clear pattern
    else:
        return ''