N of M

All functions · nseries package

NofDown

func (s Series) NofDown(n, m int) bool

NofDown reports whether at least n of the last m comparisons were lower than the preceding value. Negative n or m, n > m, or unavailable history (m >= len(s)) returns false. With n=0 and m=0, a nonempty receiver returns true.

NofDownS

func (s Series) NofDownS(n, m int) Series

NofDownS returns aligned 0/1 flags for at least n of the last m comparisons being lower than the preceding value. Negative n, m <= 0, n > m, and unavailable history yield zeros. Positions before m also remain zero.

NofUp

func (s Series) NofUp(n, m int) bool

NofUp reports whether at least n of the last m comparisons were higher than the preceding value. Negative n or m, n > m, or unavailable history (m >= len(s)) returns false. With n=0 and m=0, a nonempty receiver returns true.

NofUpS

func (s Series) NofUpS(n, m int) Series

NofUpS returns aligned 0/1 flags for at least n of the last m comparisons being higher than the preceding value. Negative n, m <= 0, n > m, and unavailable history yield zeros. Positions before m also remain zero.