Docs

ta.pivothigh

Mark a swing high once enough later bars confirm it.

itm
ta.pivothigh(source, left, right)

Pivot high, emitted at confirmation: on the bar right bars after a value that is strictly greater than the left values before it and the right values after it, this returns that pivot's value. Every other bar is na. There is no lookahead, so the pivot is reported right bars late rather than back-dated onto its own bar.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to find pivots in. Use high for a classic pivot high.
leftConstantnumber21 to 10000Bars before the pivot that must be strictly lower.
rightConstantnumber21 to 10000Bars after the pivot that confirm it, and that the result is therefore delayed by.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
left + right + 1 bars. Names in the warm-up are this operator’s parameters.
Missing values
na on every bar that does not confirm a pivot. Returns na until left + right + 1 consecutive non-na observations are in the window. An na resets it. A tie on either side is not a pivot.

Example

itm
ta.pivothigh(high, 2, 2)
itm
plot(ta.pivothigh(high, 2, 2), "Swing high")