def running_mean(idx_new, series, mean_old):
    """
    Returns the cumulative or unweighted simple moving average.
    Avoids sum of series per call.

    Keyword arguments:
    idx_new     --  current index or location of the value in the series
    series  --  list or tuple of data to average
    mean_old  --  previous average (n - 1) of the series.
    """

    if idx_new <= 0:
        return series[0,:]

    return mean_old + ((series[idx_new,:] - mean_old) / (idx_new + 1.0))