TRIX
The rate of change of a heavily smoothed moving average.
What it measures
Section titled “What it measures”TRIX smooths the close three times with exponential moving averages of the same length, then gives the percentage change of the result from one bar to the next. The triple smoothing filters out small swings, so TRIX turns only on sustained moves. With signalPeriods, it adds an EMA of TRIX.
How traders read it
Section titled “How traders read it”Traders read a cross of zero as a change of trend and a cross of the signal line as an earlier hint. On hourly forex bars the values are tiny, a few thousandths of a percent.
Formula
Section titled “Formula”triple EMA = EMA(EMA(EMA(close, periods), periods), periods)TRIX = (triple EMA − triple EMA one bar ago) / triple EMA one bar ago × 100signal = EMA(TRIX, signalPeriods)Settings and output
Section titled “Settings and output”Call: trix(periods, signalPeriods)
| Setting | Chart default |
|---|---|
periods: Periods |
15 |
signalPeriods: Signal Periods |
9 |
What you get: a list of 2, in this order: 1. a number (“trix”); 2. a number (“trix Signal”).
Warm-up: with trix(15, 9), it asks for 15 bars of history and a run-up of 99, and its first value came on bar 53 of the example data.
The prices are made up, hourly, and the same on every page, so the chart shows how the indicator behaves, not how a market behaved.
In an algorithm
Section titled “In an algorithm”function onIntervalClose() { const lines = trix(15, 9); if (OPEN_POSITIONS_COUNT === 0 && lines[0] > 0 && lines[0] > lines[1]) { openPosition("BUY", { quantity: 10000, stopLossPips: 30, takeProfitPips: 60 }); }}