Sidechair

ta.pivot_point_levels()

Browse the reference

Returns an array of pivot point levels (pivot, resistances and supports) computed from the previous period's open, high, low and close.

Try it in the editor

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

Pine Script
ta.pivot_point_levels(type: series string, anchor: series bool, developing: series bool (optional)) -> array<float>

Arguments

NameTypeDefaultDescription
typeseries stringrequiredCalculation method: "Traditional", "Fibonacci", "Woodie", "Classic", "DM" or "Camarilla". Any other text stops the script with an error.
anchorseries boolrequiredBoolean series. A true bar ends the period being measured; use timeframe.change("D") for daily levels.
developingseries boolfalseWhen 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 example array.get(levels, 1) for R1.
  • Types with fewer levels, such as DM, leave the later entries as na.

Example

Pine ScriptDaily pivot with first resistance and supportOpen in editor
//@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