% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ta_MAX.R
\name{rolling_max}
\alias{rolling_max}
\alias{MAX}
\title{Rolling Max}
\usage{
rolling_max(x, n = 30, na.bridge = FALSE)
}
\arguments{
\item{x}{(\link{double}). A \link{double} vector.}

\item{n}{(\link{integer}). Lookback period (window size). A positive \link{integer}
of \link{length} 1.}

\item{na.bridge}{(\link{logical}). A \link{logical} of \link{length} 1. \link{FALSE} by
default. When \link{FALSE}, input \code{NA}s propagate through the TA-Lib C
routine (the rolling computation typically fills the remaining
output with \code{NA}). When \link{TRUE}, input \code{NA} rows are stripped
before computation and re-inserted at the original positions in
the output, causing the statistic to treat non-consecutive
non-\code{NA} observations as if they were adjacent - see the
\strong{Handling of \code{NA} values} section above for the consequences.}
}
\value{
A \link{double} vector with the same \link{length} of \code{x}
}
\description{
\code{rolling_max()} is a generic S3 function that preserves
the input \link{class}: \link{double} vector in, \link{double} vector out.
\subsection{Handling of \code{NA} values}{

Leading \code{NA}s are always produced for the initial lookback period
where insufficient data is available. If the input itself contains
\code{NA}s, the behaviour depends on \code{na.bridge}:

\describe{
\item{\code{na.bridge = FALSE} (default)}{\code{NA}s propagate through the
TA-Lib C routine. Because rolling statistics smooth across time,
a single \code{NA} in the input typically poisons every subsequent
value.}
\item{\code{na.bridge = TRUE}}{Input \code{NA}s are stripped, the statistic
is computed on the dense series, and \code{NA}s are re-inserted at
the original positions. Output length matches input length, but
the computation treats non-consecutive observations as if they
were adjacent - fine for sparse missing values, misleading
across clustered gaps.}
}
}
}
\examples{
## load Bitcoin (BTC)
## series
data(BTC, package = "talib")

## calculate the indicator
## Open
output <- talib::rolling_max(x = BTC[[1]])

## display the results
utils::tail(output)

}
\seealso{
Other Rolling Statistic:
\code{\link[=rolling_beta]{rolling_beta()}},
\code{\link[=rolling_correlation]{rolling_correlation()}},
\code{\link[=rolling_min]{rolling_min()}},
\code{\link[=rolling_standard_deviation]{rolling_standard_deviation()}},
\code{\link[=rolling_sum]{rolling_sum()}},
\code{\link[=rolling_variance]{rolling_variance()}}
}
\author{
Serkan Korkmaz
}
\concept{Rolling Statistic}
\concept{algorithmic trading}
\concept{finance}
\concept{technical analysis}
\concept{trading}
