Summary
TrendIntensityIndex is RTTA's streaming Trend Intensity Index (TII): the
percentage of absolute close-to-SMA deviations that are positive over a rolling
window, scaled to \(0\)–\(100\).
Update API
value = rtta.TrendIntensityIndex(window=30, fillna=True).update(close)
With fillna=False, output is NaN until window samples have been seen.
Theory Of Operation
TII measures how consistently price sits above its moving average. For each bar the signed residual \(close - SMA\) is split into a positive part and its absolute value; rolling sums of those quantities form a ratio. A reading near 100 means price has been almost exclusively above the SMA (strong uptrend intensity); near 0 means almost exclusively below; near 50 means a balanced mix.
Recurrence
Let \(c_t\) be close and \(n\) be window (default \(30\)).
Maintain rolling sums over the last \(\min(t, n)\) samples:
The nested SMA is constructed with fillna=True. Outer warm count is \(n\).
Implementation Notes
The recurrence is implemented in src/rtta/indicator.cpp in
class TrendIntensityIndex with members sma_, pos_, and abs_.
