Technical indicators#

Market indicators: trend, momentum, bands, volume, and returns.

Trend#

Direction and trend-following: trend-tracking averages, slope fits, ADX, and channels.

Function

Description

Average Directional Index (ADX)

Wilder's ADX with +DI and -DI (3 inputs -> 3 outputs).

Average Directional Index Rating (ADXR)

Wilder's ADXR, the mean of ADX now and ADX one window ago.

Online Bayesian regression

Online Bayesian linear regression with a forgetting factor: the current slope and intercept, and a one-step-ahead predictive mean and standard deviation.

Double Exponential MA (DEMA)

Mulloy's Double EMA: 2*EMA - EMA(EMA).

Detrend

x[t] minus its rolling mean.

Donchian Channels

Trend-following envelope: rolling max(high), rolling min(low), and midline.

Directional index (DX)

Wilder directional index, the pre-average input to ADX.

Expanding slope

Running OLS slope of the series against time over the whole history.

Hull MA

Hull's responsive MA: WMA(2*WMA(n/2) - WMA(n), sqrt(n)).

Kaufman Adaptive MA (KAMA)

Adaptive MA whose smoothing constant responds to the efficiency ratio.

MACD

MACD line, signal line, and histogram (3 outputs).

Minus directional indicator (-DI)

Wilder negative directional indicator.

Minus directional movement (-DM)

Wilder smoothed negative directional movement.

Plus directional indicator (+DI)

Wilder positive directional indicator.

Plus directional movement (+DM)

Wilder smoothed positive directional movement.

Rolling Hurst Exponent

Rolling-window Hurst exponent via Anis-Lloyd corrected rescaled-range analysis.

Rolling linear regression

Rolling OLS fit of y on x, returning slope, intercept, R-squared and the standard error of the fit.

Rolling 1st-order polynomial fit

OLS fit y = a + b*t over a trailing window. derivative_order selects value/slope/zero.

Rolling 2nd-order polynomial fit

OLS fit y = a + b*t + c*t^2 over a trailing window.

Rolling Time-Series Forecast (TSF)

Linear regression of the input on time, projected one step ahead (TA-Lib TSF).

Triple Exponential MA (TEMA)

Mulloy's Triple EMA: 3*EMA - 3*EMA(EMA) + EMA(EMA(EMA)).

TRIX (rate of change of triple EMA)

ROC of a triple-smoothed EMA.

Momentum & oscillators#

Rate-of-change and overbought/oversold indicators.

Function

Description

Chaikin A/D Oscillator (ADOSC)

Difference of fast and slow EMA of the Accumulation/Distribution line.

Average Directional Index (ADX)

Wilder's ADX with +DI and -DI (3 inputs -> 3 outputs).

Balance of Power (BOP)

(close - open) / (high - low) per bar. No smoothing.

Commodity Channel Index (CCI)

Commodity Channel Index over typical price.

MACD

MACD line, signal line, and histogram (3 outputs).

Money Flow Index (MFI)

Volume-weighted analogue of RSI on the typical price.

Momentum

x[t] - x[t-k], TA-Lib's MOM. Mathematically identical to Diff(k).

Rate of change (ROC)

Rate of change 100 * (x[t] / x[t-k] - 1), in percent (TA-Lib ROC).

Rolling RSI

Relative Strength Index. Wilder's smoothing by default; Cutler's via method='cutler'.

Stochastic Oscillator

Stochastic oscillator %K and %D from high, low and close.

Stochastic RSI

Stochastic oscillator applied to the RSI, giving %K and %D.

TRIX (rate of change of triple EMA)

ROC of a triple-smoothed EMA.

Ultimate Oscillator

Three-period weighted oscillator (Williams, 1976).

Williams %R

Inverse stochastic oscillator in [-100, 0].

Bands & channels#

Envelopes around price.

Function

Description

Bollinger Bands

Mean +/- num_std rolling standard deviations.

Donchian Channels

Trend-following envelope: rolling max(high), rolling min(low), and midline.

Keltner Channels

Volatility-adapted envelope: EMA midline plus/minus a multiple of ATR.

Volatility indicators#

True range, ATR, and normalized ATR for stops, sizing, and channels.

Function

Description

Average True Range (ATR)

Wilder-smoothed average of TrueRange.

Normalized ATR (NATR)

ATR scaled to a percentage of the current close.

True Range (Wilder)

Per-bar true range accounting for overnight gaps (Wilder, 1978).

Volume#

Volume-based indicators.

Function

Description

Accumulation/Distribution Line (Chaikin)

Chaikin Accumulation/Distribution Line.

Chaikin A/D Oscillator (ADOSC)

Difference of fast and slow EMA of the Accumulation/Distribution line.

Money Flow Index (MFI)

Volume-weighted analogue of RSI on the typical price.

On-Balance Volume (OBV)

On-Balance Volume: signed cumulative volume by close-direction (Granville, 1963).

Rolling VWAP

Rolling volume-weighted average price (typical-price weighted).

Returns & changes#

Differences, returns, rates of change, and lags.

Function

Description

Discrete difference

x[t] - x[t-k] (first difference at lag k).

Second difference

Second-order finite difference (discrete second derivative).

Lag (delay)

Output is the input delayed by k samples.

Log return

Log return log(x[t] / x[t-k]) at lag k.

Momentum

x[t] - x[t-k], TA-Lib's MOM. Mathematically identical to Diff(k).

Simple return

Simple return (x[t] - x[t-k]) / x[t-k] at lag k.

Rate of change (ROC)

Rate of change 100 * (x[t] / x[t-k] - 1), in percent (TA-Lib ROC).

Rate of change percent (ROCP)

Rate of change x[t] / x[t-k] - 1, as a fraction (TA-Lib ROCP). Identical to Return.

Rate of change ratio (ROCR)

Rate of change ratio x[t] / x[t-k] (TA-Lib ROCR).

Cycles & spectra#

Dominant cycle, phase, amplitude, and frequency from the analytic signal.

Function

Description

Instantaneous cycle amplitude

Instantaneous amplitude (envelope) of the dominant cycle, scaled to the input amplitude.

Instantaneous cycle frequency

Instantaneous frequency, in cycles per sample, via Ehlers' homodyne discriminator.

Instantaneous cycle phase

Instantaneous phase, in degrees, of Ehlers' in-phase and quadrature components.

Cycle sinewave indicator

Ehlers' sinewave indicator (sine, leadsine) from the phase of the dominant cycle.

Dominant cycle period

Dominant cycle period via Ehlers' homodyne discriminator.

Hilbert in-phase / quadrature components

Ehlers' in-phase and quadrature components (TA-Lib HT_PHASOR), scaled to the input amplitude.

Trend-vs-cycle classifier

Ehlers' trend mode, 1.0 while the series trends and 0.0 while it cycles.