Returns the largest value source has taken from the first bar to the current one.
ta.max keeps a running maximum. It starts with the first value and only rises, ignoring na values.
Use it for the all-time high of a series on the loaded history, such as a peak equity or peak RSI.
Syntax
ta.max(source: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | The series whose highest value so far is kept. Later bars can only raise it. |
Returns
series float: the maximum of source over all bars so far.
Remarks
- The result depends on how many bars are loaded. For a fixed window use
ta.highest. - Not to be confused with
math.max, which compares its arguments on one bar.
Example
//@version=6
indicator("Drawdown from high")
peak = ta.max(close)
plot((close / peak - 1) * 100, "Drawdown %", color = color.red, style = plot.style_area)See also
Runs on Sidechair