ta.pivothigh
Mark a swing high once enough later bars confirm it.
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.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to find pivots in. Use high for a classic pivot high. |
left | Constant | number | 2 | 1 to 10000 | Bars before the pivot that must be strictly lower. |
right | Constant | number | 2 | 1 to 10000 | Bars after the pivot that confirm it, and that the result is therefore delayed by. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
left + right + 1bars. 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
ta.pivothigh(high, 2, 2)plot(ta.pivothigh(high, 2, 2), "Swing high")