def EMA(df, n, price='Close'):
    """
    Exponential Moving Average
    Returns: list of floats = jhta.EMA(df, n, price='Close')
    Source: https://www.fmlabs.com/reference/default.htm?url=ExpMA.htm
    """
    ema_list = []
    for i in range(len(df[price])):
        if i + 1 < n:
            ema = float('NaN')
        else:
            if ema != ema:
                ema = df[price][i]
            k = 2 / (n + 1)
            ema = k * df[price][i] + (1 - k) * ema
        ema_list.append(ema)
    return ema_list
