def macd(series, fast=3, slow=10, smooth=16):
    """
    compute the MACD (Moving Average Convergence/Divergence)
    using a fast and slow exponential moving avg'
    return value is emaslow, emafast, macd which are len(x) arrays
    """
    macd_line = rolling_weighted_mean(series, window=fast) - \
        rolling_weighted_mean(series, window=slow)
    signal = rolling_weighted_mean(macd_line, window=smooth)
    histogram = macd_line - signal
    # return macd_line, signal, histogram
    return pd.DataFrame(index=series.index, data={
        'macd': macd_line.values,
        'signal': signal.values,
        'histogram': histogram.values
    })
def macd ( series , fast = 3 , slow = 10 , smooth = 16 ) : macd_line = rolling_weighted_mean ( series , window = fast ) - rolling_weighted_mean ( series , window = slow ) signal = rolling_weighted_mean ( macd_line , window = smooth ) histogram = macd_line - signal return pd . DataFrame ( index = series . index , data = { 'macd' : macd_line . values , 'signal' : signal . values , 'histogram' : histogram . values } )
compute the MACD (Moving Average Convergence/Divergence)
    using a fast and slow exponential moving avg'
    return value is emaslow, emafast, macd which are len(x) arrays