Triple EMA Oscillator (TRIX)

get_trix(quotes, lookback_periods, signal_periods=None)

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) in each of the the exponential moving averages. Must be greater than 0.
signal_periods int, Optional Number of periods in the moving average of TRIX. Must be greater than 0, if specified.

Historical quotes requirements

You must have at least 4×N or 3×N+100 periods of quotes, whichever is more, to cover the warmup periods. Since this uses a smoothing technique, we recommend you use at least 3×N+250 data points prior to the intended usage date for better precision.

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

TRIXResults[TRIXResult]

Convergence warning: The first 3×N+250 periods will have decreasing magnitude, convergence-related precision errors that can be as high as ~5% deviation in indicator values for earlier periods.

TRIXResult

name type notes
date datetime Date
ema3 float, Optional 3 EMAs of the Close price
trix float, Optional Rate of Change of 3 EMAs
signal float, Optional SMA of trix based on signal_periods periods, if specified

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 20-period Trix
results = indicators.get_trix(quotes, 14)

About Triple EMA Oscillator (TRIX)

Created by Jack Hutson, TRIX is the rate of change for a 3 EMA smoothing of the Close price over a lookback window. TRIX is often confused with TEMA. [Discuss] 💬

image

Sources