示例#1
0
def adxr(adx: NdType, periods: int) -> NdType:
    prev_adx = shift(adx, periods)
    return (adx + prev_adx) / 2
示例#2
0
def m(high: NdType, low: NdType) -> tp.Tuple[NdType, NdType]:
    plus_m = high - shift(high, 1)
    minus_m = shift(low, 1) - low
    return plus_m, minus_m
示例#3
0
def roc(series: nda.NdType, periods: int = 7) -> nda.NdType:
    """
    Rate of change
    """
    shifted = shift(series, periods)
    return 100 * (series / shifted - 1)
示例#4
0
def change(series: np.ndarray, periods: int = 1) -> np.ndarray:
    shifted = shift(series, periods)
    return series - shifted
示例#5
0
文件: atr.py 项目: quantiacs/toolbox
def tr(high: NdType, low: NdType, close: NdType) -> NdType:
    prev_close = shift(close, 1)
    return np.maximum(high, prev_close) - np.minimum(low, prev_close)