def adxr(adx: NdType, periods: int) -> NdType: prev_adx = shift(adx, periods) return (adx + prev_adx) / 2
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
def roc(series: nda.NdType, periods: int = 7) -> nda.NdType: """ Rate of change """ shifted = shift(series, periods) return 100 * (series / shifted - 1)
def change(series: np.ndarray, periods: int = 1) -> np.ndarray: shifted = shift(series, periods) return series - shifted
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)