def upper_bollinger_band(data, period, std_mult=2.0):
    """
    Upper Bollinger Band.

    Formula:
    u_bb = SMA(t) + STD(SMA(t-n:t)) * std_mult
    """
    catch_errors.check_for_period_error(data, period)

    period = int(period)
    simple_ma = sma(data, period)[period-1:]

    upper_bb = []
    for idx in range(len(data) - period + 1):
        std_dev = np.std(data[idx:idx + period])
        upper_bb.append(simple_ma[idx] + std_dev * std_mult)
    upper_bb = fill_for_noncomputable_vals(data, upper_bb)

    return np.array(upper_bb)
def upper_bollinger_band ( data , period , std_mult = 2.0 ) : catch_errors . check_for_period_error ( data , period ) period = int ( period ) simple_ma = sma ( data , period ) [ period - 1 : ] upper_bb = [ ] for idx in range ( len ( data ) - period + 1 ) : std_dev = np . std ( data [ idx : idx + period ] ) upper_bb . append ( simple_ma [ idx ] + std_dev * std_mult ) upper_bb = fill_for_noncomputable_vals ( data , upper_bb ) return np . array ( upper_bb )
Upper Bollinger Band.

    Formula:
    u_bb = SMA(t) + STD(SMA(t-n:t)) * std_mult