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).

Online Bayesian univariate regression (2->4 posterior fit)

Causal one-step-ahead predictive mean and std plus current slope and intercept via Normal-Inverse-Gamma posterior.

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.

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).

Rolling Hurst Exponent

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

Rolling linear regression (2->4 OLS fit)

Full OLS fit returning (slope, intercept, r_squared, stderr).

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 y on time, projected one step ahead. TA-Lib's 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)

100 * (x[t] / x[t-k] - 1) - TA-Lib's ROC.

Rolling RSI

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

Stochastic Oscillator

Stochastic oscillator %K and %D (3 inputs -> 2 outputs).

Stochastic RSI

Stochastic applied to RSI (1 input -> 2 outputs).

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.

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(x[t] / x[t-k]) - log return at lag k.

Momentum

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

Simple return

(x[t] - x[t-k]) / x[t-k] - the simple percentage return at lag k.

Rate of change (ROC)

100 * (x[t] / x[t-k] - 1) - TA-Lib's ROC.

Rate of change percent (ROCP)

x[t] / x[t-k] - 1 - TA-Lib's ROCP. Identical to Return.

Rate of change ratio (ROCR)

x[t] / x[t-k] - TA-Lib's ROCR.