Skip to content

The rate of change of a heavily smoothed moving average.

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.

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.

triple EMA = EMA(EMA(EMA(close, periods), periods), periods)
TRIX = (triple EMA − triple EMA one bar ago) / triple EMA one bar ago × 100
signal = EMA(TRIX, signalPeriods)

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.

TRIX drawn by its own code on example prices

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.

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 });
}
}