Example #1
0
def emv(hl, volume, window=9, ma_type='sma', vol_divisor=1000):
    '''EMV'''
    high, low = utils.safe_hl(hl)
    volume = utils.safe_series(volume)
    mid = .5 * (high + low)
    volume /= vol_divisor
    rval = (mid - mid.shift(1)) / (volume / (high - low))
    rval_ma = ma.get_ma(ma_type)(rval, window)
    return pd.DataFrame(dict(emv=rval, maEMV=rval_ma), index=hl.index)
Example #2
0
def sar(hl, accel=(0.02, 0.2), sig_init=-1, gap_init=1.):
    high, low = utils.safe_hl(hl)
    assert sig_init in [-1, 1]
    assert gap_init > 0 and gap_init < 10
    return fast.sar(high, low, accel[0], accel[1], sig_init, gap_init)