Vortex Indicator (VI)
get_vortex(quotes, lookback_periods)
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 | Number of periods (N ) to consider. Must be greater than 1 and is usually between 14 and 30. |
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
VortexResults[VortexResult]
- This method returns a time series of all available indicator values for the
quotes
provided. VortexResults
is just a list ofVortexResult
.- 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
N
periods will haveNone
values for VI since there’s not enough data to calculate.
VortexResult
name | type | notes |
---|---|---|
date | datetime | Date |
pvi | float, Optional | Positive Vortex Indicator (VI+) |
nvi | float, Optional | Negative Vortex Indicator (VI-) |
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 14-period VI
results = indicators.get_vortex(quotes, 14);
About Vortex Indicator (VI)
Created by Etienne Botes and Douglas Siepman, the Vortex Indicator is a measure of price directional movement. It includes positive and negative indicators, and is often used to identify trends and reversals. [Discuss] 💬