This implementation is minimal without error checking, or NA handling. It is taken from the ichimoku package which had several more complicated variants, and is reused here with just tidyCpp.
rollMinMax(x, window, min = TRUE)
A vector of the same length as 'x' with elements 1 to (length(window) - 1) containing NAs.
A numeric vector.
An interger with the size of the rolling window.
A logical which, if true, selects minimum, else maximum
Dirk Eddelbuettel for this version, R Core for the underlying code
The ichimoku variant is by Charlie Gao and credits Andrew Uhl for the initial implementation.