UtilityPine Script v6

ta.highest()Highest Value

Highest value for a given number of bars back.

TradingView language reference

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

The length-bar window includes the current bar; na values are ignored. The one-argument overload ta.highest(length) uses high. For a breakout against earlier bars, define a prior-bar window explicitly rather than comparing high with a maximum that already includes it.

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

Draft Pine Script using ta.highest() with Pineify's AI Coding Agent, then review the arguments and test the result on your chart. Usage depends on your plan and available credits.