Returns an array of pivot point levels (pivot, resistances and supports) computed from the previous period's open, high, low and close.
ta.pivot_point_levels builds levels for the chosen type from the finished period before the latest anchor. It returns an array of 11 floats in this order: P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5. Levels a type does not define are na.
type is one of "Traditional", "Fibonacci", "Woodie", "Classic", "DM" or "Camarilla". A true value of anchor ends the current period and starts the next. Until a first period has finished, every level is na. With developing set to true, the levels follow the period still forming.
Syntax
ta.pivot_point_levels(type: series string, anchor: series bool, developing: series bool (optional)) -> array<float>Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| type | series string | required | Calculation method: "Traditional", "Fibonacci", "Woodie", "Classic", "DM" or "Camarilla". Any other text stops the script with an error. |
| anchor | series bool | required | Boolean series. A true bar ends the period being measured; use timeframe.change("D") for daily levels. |
| developing | series bool | false | When true, the levels are computed from the current period so far instead of the finished one. |
Returns
array<float>: an array of 11 floats: P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5.
Remarks
- Read a level with
array.get, for examplearray.get(levels, 1)for R1. - Types with fewer levels, such as DM, leave the later entries as na.
Example
//@version=6
indicator("Daily pivots", overlay = true)
levels = ta.pivot_point_levels("Traditional", timeframe.change("D"))
plot(array.get(levels, 0), "Pivot", color = color.gray, style = plot.style_linebr)
plot(array.get(levels, 1), "R1", color = color.red, style = plot.style_linebr)
plot(array.get(levels, 2), "S1", color = color.green, style = plot.style_linebr)See also
Runs on Sidechair