UtilityPine Script v6

ta.highest()Highest Value

Highest value for a given number of bars back.

Syntax

Syntax
ta.highest(source, length) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries to scan.
lengthseries intLookback length.

Returns

Highest value in the series.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.highest")
plot(ta.highest(high, 20), title="20-bar highest high")

Trading Applications

Find the highest price over a lookback period

Build Donchian Channel indicators

Create breakout detection systems

Calculate relative position within a range

Related Functions

Frequently Asked Questions

ta.highest(source, length) returns the maximum value of source over the most recent length bars, ignoring na values.

Use ta.highest(close, 20). For session or anchored windows, combine with different sources or logic as needed.

Yes—any numeric series works, including calculated indicators, not only OHLC fields.

Generate ta.highest() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.highest() and other built-in functions instantly.