Pivot Points

get_pivot_points(quotes, window_size, point_type=PivotPointType.STANDARD)

Parameters

name type notes
quotes Iterable[Quote] Iterable of the Quote class or its sub-class.
See here for usage with pandas.DataFrame
window_size PeriodSize Size of the lookback window. See PeriodSize options below.
point_type PivotPointType, default PivotPointType.STANDARD Type of Pivot Point. See PivotPointType options below.

Historical quotes requirements

You must have at least 2 windows of quotes to cover the warmup periods. For example, if you specify a WEEK window size, you need at least 14 calendar days of quotes.

quotes is an Iterable[Quote] collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.

PeriodSize options (for window_size)

from stock_indicators.indicators.common.enums import PeriodSize
type description
PeriodSize.MONTH Use the prior month’s data to calculate current month’s Pivot Points
PeriodSize.WEEK [..] weekly
PeriodSize.DAY [..] daily. Commonly used for intraday data.
PeriodSize.ONEHOUR [..] hourly

PivotPointType options

from stock_indicators.indicators.common.enums import PivotPointType
type description
PivotPointType.STANDARD Floor Trading (default)
PivotPointType.CAMARILLA Camarilla
PivotPointType.DEMARK Demark
PivotPointType.FIBONACCI Fibonacci
PivotPointType.WOODIE Woodie

Return

PivotPointsResults[PivotPointsResult]

🚩 Warning: The second window may be inaccurate if the first window contains incomplete data. For example, this can occur if you specify a Month window size and only provide 45 calendar days (1.5 months) of quotes.

👉 Repaint warning: the last window will be repainted if it does not contain a full window of data.

PivotPointsResult

name type notes
date datetime Date
r3 Decimal, Optional Resistance level 3
r2 Decimal, Optional Resistance level 2
r1 Decimal, Optional Resistance level 1
pp Decimal, Optional Pivot Point
s1 Decimal, Optional Support level 1
s2 Decimal, Optional Support level 2
s3 Decimal, Optional Support level 3

Utilities

See Utilities and Helpers for more information.

Example

from stock_indicators import indicators
from stock_indicators import PeriodSize, PivotPointType      # Short path, version >= 0.8.1

# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")

# Calculate Woodie-style month-based Pivot Points
results = indicators.get_pivot_points(quotes, PeriodSize.MONTH, PivotPointType.WOODIE);

About Pivot Points

Pivot Points depict support and resistance levels, based on the prior lookback window. You can specify window size (e.g. month, week, day, etc). See also the alternative Rolling Pivot Points variant for a modern update that uses a rolling window. [Discuss] 💬

image

Sources