דלגו לתוכן
פתיחת RaamTrade

TRIX

תוכן זה אינו זמין עדיין בשפה שלך.

The one-bar rate of change of a triple-smoothed EMA, in basis points. Triple smoothing filters out cycles shorter than the period, so what remains is the trend’s direction and turning points; zero-line crosses are the classic signal.

Signature

TRIX(period, on=<source>)
Argument Type Required Notes
period int Param or literal Yes EMA length used three times. Default 15, bounds 1–200.
on= symbol, OHLCV field, or indicator No Source. Defaults to the trade symbol’s close.

Formula

$$ e_1 = \text{EMA}(C, n), \quad e_2 = \text{EMA}(e_1, n), \quad e_3 = \text{EMA}(e_2, n) $$ $$ \text{TRIX}_t = 10000 \cdot \frac{e_3(t) - e_3(t-1)}{e_3(t-1)} $$

Warmup

The recursion starts from the first close and converges over roughly 3n bars; 0 on the first bar. Early values differ slightly from implementations seeded on longer history.

Reading the value

trix.value
trix > 0
trix.crossed_above(0)

Example

class TrixCross(Strategy):
"""Trend entry on a TRIX zero cross."""
period = Param(15, min=1, max=200)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
trix = TRIX(self.period, on=self.trade)
if trix.crossed_above(0) and self.trade.is_flat:
self.buy(self.trade, reason="TRIX up through zero")
if trix.crossed_below(0) and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="TRIX down through zero")

Notes

  • Jack Hutson, Technical Analysis of Stocks & Commodities (1980s).
  • Scaled in basis points (×10000). TA-Lib’s TRIX is ×100 (percent) — divide by 100 to compare.
  • Proven by an assert-via-trade run on SPY daily (converged to an independent strategy-side triple-EMA replication within 0.05 bp after 40 bars; zero alarm trades).
  • All three EMAs seed from the first value rather than an SMA window; stated here because the first ~3n bars differ, by a decaying amount, from an implementation that seeds from an SMA window.