Choppiness Index
get_chop(quotes, lookback_periods=14)
Parameters
| name | type | notes |
|---|---|---|
quotes | Iterable[Quote] | Iterable of the Quote class or its sub-class. • See here for usage with pandas.DataFrame |
lookback_periods | int, default 14 | Number of periods (N) for the lookback evaluation. Must be greater than 1. |
Historical quotes requirements
You must have at least N+1 periods of quotes to cover the warmup periods.
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.
Return
ChopResults[ChopResult]
- This method returns a time series of all available indicator values for the
quotesprovided. ChopResultsis just a list ofChopResult.- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- The first
Nperiods will haveNonevalues since there’s not enough data to calculate.
ChopResult
| name | type | notes |
|---|---|---|
date | datetime | Date |
chop | float, Optional | Choppiness Index |
Utilities
See Utilities and Helpers for more information.
Example
from stock_indicators import indicators
# This method is NOT a part of the library.
quotes = get_historical_quotes("SPY")
# Calculate CHOP(14)
results = indicators.get_chop(quotes, 14)
About Choppiness Index
Created by E.W. Dreiss, the Choppiness Index measures the trendiness or choppiness on a scale of 0 to 100, to depict steady trends versus conditions of choppiness. [Discuss] 💬
