Calculated EMAs very different from displayed

I’m calculating EMAs 20, 50, and 100 for 1m candles using python TA-Lib on the futures testnet. And I see the calculated values off by a big margin from the displayed ones. Any idea why that is?

    Calculate EMAs using TA-Lib and determine the current trend.
    # Calculate EMAs using TA-Lib
    df['EMA20'] = talib.EMA(df['Close'].values, timeperiod=20)
    df['EMA50'] = talib.EMA(df['Close'].values, timeperiod=50)
    df['EMA100'] = talib.EMA(df['Close'].values, timeperiod=100)

    # Get the last values of the EMAs
    last_ema20 = df['EMA20'].iloc[-1]
    last_ema50 = df['EMA50'].iloc[-1]
    last_ema100 = df['EMA100'].iloc[-1]

    print(f"EMA20: {last_ema20}, EMA50: {last_ema50}, EMA100: {last_ema100}")  # Debugging line
 # Fetch initial historical data
    candles = client.get_klines(symbol="BTCUSDT", interval=Client.KLINE_INTERVAL_1MINUTE, limit=1000)
    df = pd.DataFrame(candles, columns=['Open time', 'Open', 'High', 'Low', 'Close', 'Volume', 'Close time', 'Quote asset volume', 'Number of trades', 'Taker buy base asset volume', 'Taker buy quote asset volume', 'Ignore'])
    df['Close'] = pd.to_numeric(df['Close'])

It seems the issue might be related to the non-official Binance library you’re using. I recommend reaching out to the library’s community for assistance or considering the official Binance library to check for any differences.

You mean TA-Lib? No, that’s not the problem. I’ve written this code using simply pandas and the issue is the same.

I meant the following library: python-binance · PyPI