ta.max()
Max
Returns the greater of two values. Note: This is a simple comparison, not a lookback function like ta.highest().
Syntax
ta.max(source1, source2) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source1 | series int/float | First value or series. |
| source2 | series int/float | Second value or series. |
Returns
The greater of the two values.
Remarks
Evaluates element-wise on each bar; unrelated to ta.highest() window extrema.
Code Examples
//@version=6
indicator("ta.max")
plot(ta.max(close, open), title="Greater of O/C")Trading Applications
Compare two indicator values
Build custom indicator combinations
Create conditional calculations
Use in true range computation
Related Functions
Frequently Asked Questions
Generate ta.max() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.max() and other built-in functions instantly.
Related Pine Script Functions
ta.min() - Min
Learn how to use ta.min() in Pine Script. Return the lesser of two values.
ta.highest() - Highest Value
Learn how to use ta.highest() in Pine Script. Find the highest value over a lookback period for Donchian Channels.
ta.range() - Range
Learn how to use ta.range() in Pine Script. Calculate the price range (highest minus lowest) over a period.
ta.pivothigh() - Pivot High
Learn how to use ta.pivothigh() in Pine Script. Detect swing high pivot points for resistance levels.
ta.atr() - Average True Range
Learn how to use ta.atr() in Pine Script. Syntax, parameters, code examples for the Average True Range volatility indicator.