Stock Indicators for Python provides financial market technical indicators from historical price quotes.
Price overlays and support/resistance indicators that are plotted directly on price charts to identify trend direction, support/resistance levels, and potential entry/exit points.
Trend-following indicator that provides stop-and-reverse points for position management.
def get_parabolic_sar(quotes: Iterable[Quote], acceleration_factor: float = 0.02, max_acceleration_factor: float = 0.2):
"""
Parabolic SAR - stop and reverse points for trend following.
Args:
quotes (Iterable[Quote]): Historical price quotes
acceleration_factor (float): Initial acceleration factor (defaults to 0.02)
max_acceleration_factor (float): Maximum acceleration factor (defaults to 0.2)
Returns:
ParabolicSarResults[ParabolicSarResult]: Collection of Parabolic SAR results
"""Trend-following overlay using ATR-based dynamic support and resistance levels.
def get_super_trend(quotes: Iterable[Quote], lookback_periods: int = 10, multiplier: float = 3.0):
"""
SuperTrend - ATR-based trend following indicator.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): ATR calculation periods (defaults to 10)
multiplier (float): ATR multiplier for distance (defaults to 3.0)
Returns:
SuperTrendResults[SuperTrendResult]: Collection of SuperTrend results
"""Comprehensive trend analysis system with multiple components for support/resistance and momentum.
def get_ichimoku(quotes: Iterable[Quote], tenkan_periods: int = 9, kijun_periods: int = 26,
senkou_b_periods: int = 52, senkou_offset: int = None, chikou_offset: int = None):
"""
Ichimoku Cloud - comprehensive trend analysis system.
Args:
quotes (Iterable[Quote]): Historical price quotes
tenkan_periods (int): Tenkan-Sen (conversion line) periods (defaults to 9)
kijun_periods (int): Kijun-Sen (base line) periods (defaults to 26)
senkou_b_periods (int): Senkou Span B periods (defaults to 52)
senkou_offset (int): Leading span offset periods (optional)
chikou_offset (int): Chikou span offset periods (optional)
Returns:
IchimokuResults[IchimokuResult]: Collection of Ichimoku results
"""Bill Williams' trend-following system using three smoothed moving averages.
def get_alligator(quotes: Iterable[Quote], jaw_periods: int = 13, teeth_periods: int = 8, lips_periods: int = 5):
"""
Williams Alligator - three smoothed moving averages for trend analysis.
Args:
quotes (Iterable[Quote]): Historical price quotes
jaw_periods (int): Jaw line periods (defaults to 13)
teeth_periods (int): Teeth line periods (defaults to 8)
lips_periods (int): Lips line periods (defaults to 5)
Returns:
AlligatorResults[AlligatorResult]: Collection of Alligator results
"""Trend strength indicator measuring time since highest high and lowest low.
def get_aroon(quotes: Iterable[Quote], lookback_periods: int = 25):
"""
Aroon - measures trend strength using time since high/low.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): Number of periods for calculation (defaults to 25)
Returns:
AroonResults[AroonResult]: Collection of Aroon results
"""Measures trend strength without regard to trend direction.
def get_adx(quotes: Iterable[Quote], lookback_periods: int = 14):
"""
Average Directional Index (ADX) - measures trend strength.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): Number of periods for calculation (defaults to 14)
Returns:
ADXResults[ADXResult]: Collection of ADX results
"""Volatility-based trailing stop using ATR calculations.
def get_chandelier(quotes: Iterable[Quote], lookback_periods: int = 22, multiplier: float = 3.0,
type: ChandelierType = ChandelierType.LONG):
"""
Chandelier Exit - ATR-based trailing stop indicator.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): ATR calculation periods (defaults to 22)
multiplier (float): ATR multiplier (defaults to 3.0)
type (ChandelierType): Long or short exit type (defaults to LONG)
Returns:
ChandelierResults[ChandelierResult]: Collection of Chandelier Exit results
"""Support and resistance levels calculated from previous period's OHLC data.
def get_pivot_points(quotes: Iterable[Quote], window_periods: int = 1,
point_type: PivotPointType = PivotPointType.STANDARD):
"""
Pivot Points - support and resistance levels from previous period OHLC.
Args:
quotes (Iterable[Quote]): Historical price quotes
window_periods (int): Number of periods for calculation (defaults to 1)
point_type (PivotPointType): Calculation method (defaults to STANDARD)
Returns:
PivotPointsResults[PivotPointsResult]: Collection of Pivot Points results
"""Dynamic stop-loss levels based on Average True Range calculations.
def get_atr_stop(quotes: Iterable[Quote], lookback_periods: int = 21, multiplier: float = 3.0,
end_type: EndType = EndType.CLOSE):
"""
ATR Stop Loss - dynamic stop levels using Average True Range.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): ATR calculation periods (defaults to 21)
multiplier (float): ATR multiplier for distance (defaults to 3.0)
end_type (EndType): Use CLOSE or HIGH_LOW prices (defaults to CLOSE)
Returns:
AtrStopResults[AtrStopResult]: Collection of ATR Stop results
"""Trend-following stop based on price volatility and trend direction.
def get_volatility_stop(quotes: Iterable[Quote], lookback_periods: int = 7, multiplier: float = 3.0):
"""
Volatility Stop - trend-following stop based on price volatility.
Args:
quotes (Iterable[Quote]): Historical price quotes
lookback_periods (int): Volatility calculation periods (defaults to 7)
multiplier (float): Volatility multiplier (defaults to 3.0)
Returns:
VolatilityStopResults[VolatilityStopResult]: Collection of Volatility Stop results
"""Install with Tessl CLI
npx tessl i tessl/pypi-stock-indicators